diff --git a/src/App.tsx b/src/App.tsx index 854a891..399d4d1 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,12 +1,39 @@ import './App.css'; -import MailboxList from './Mailbox'; +//import MailboxList from './Mailbox'; +import React, { useEffect, useState } from 'react' +interface IUser { + name: string; + id: string; +} + +const App = () => { + const [users, setUsers] = useState>([]) + + const fetchUserData = () => { + fetch("https://jsonplaceholder.typicode.com/users") + .then(response => { + return response.json() + }) + .then(data => { + setUsers(data) + }) + } + + useEffect(() => { + fetchUserData() + }, []) -function App() { return (
- + {users.length > 0 && ( + + )}
); }