Skip to content

Instantly share code, notes, and snippets.

@hesan-aminiloo
Created July 15, 2022 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hesan-aminiloo/a9cb2fc695ed86e06f7b8fe25898751d to your computer and use it in GitHub Desktop.
Save hesan-aminiloo/a9cb2fc695ed86e06f7b8fe25898751d to your computer and use it in GitHub Desktop.
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