Move TodoItem from App.tsx to standalone types.ts

This commit is contained in:
Jason Zhu 2023-03-02 16:52:11 +11:00
parent 01cbf39684
commit 8473df7a16
2 changed files with 6 additions and 6 deletions

View File

@ -1,12 +1,7 @@
import React, {useState} from 'react';
import './App.css';
import Todo from "./Todo";
interface TodoItem {
id: number;
text: string;
completed: boolean;
}
import {TodoItem} from "./types";
function App() {
const [todos, setTodos] = useState<TodoItem[]>([]);

5
src/types.ts Normal file
View File

@ -0,0 +1,5 @@
export interface TodoItem {
id: number;
text: string;
completed: boolean;
}