Created
July 15, 2022 13:12
-
-
Save hesan-aminiloo/a9cb2fc695ed86e06f7b8fe25898751d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Users = () => { | |
const [users, setUsers] = useState([]); | |
useEffect(() => { | |
fetch('/zighi.com/api/users') | |
.then((response) => response.json()) | |
.then((json) => setUsers(json)); | |
}, []); | |
return ( | |
<> | |
<h1>Users List</h1> | |
{users.map((user) => ( | |
<div> | |
<h2>{user.name}</h2> | |
</div> | |
))} | |
</> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment