Move TodoItem from App.tsx to standalone types.ts
This commit is contained in:
parent
01cbf39684
commit
8473df7a16
@ -1,12 +1,7 @@
|
|||||||
import React, {useState} from 'react';
|
import React, {useState} from 'react';
|
||||||
import './App.css';
|
import './App.css';
|
||||||
import Todo from "./Todo";
|
import Todo from "./Todo";
|
||||||
|
import {TodoItem} from "./types";
|
||||||
interface TodoItem {
|
|
||||||
id: number;
|
|
||||||
text: string;
|
|
||||||
completed: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const [todos, setTodos] = useState<TodoItem[]>([]);
|
const [todos, setTodos] = useState<TodoItem[]>([]);
|
||||||
|
5
src/types.ts
Normal file
5
src/types.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export interface TodoItem {
|
||||||
|
id: number;
|
||||||
|
text: string;
|
||||||
|
completed: boolean;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user