Skip to content

Instantly share code, notes, and snippets.

@yasudacloud
Created April 7, 2023 13:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
const [users, setUsers] = useState<api.User[]>([])
useEffect(() => {
const client = api.UserApiFactory(undefined, 'http://localhost:8000')
client.usersApiUsersGet().then(response => {
setUsers(response.data)
})
}, [setUsers])
return (
<div className="App">
<div style={{margin: 20}}>
<table>
{
users.map(user => (
<tr>
<td>{user.id}</td>
<td>{user.name}</td>
<td>{user.created}</td>
</tr>
))
}
</table>
</div>
</div>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment