Skip to content

Instantly share code, notes, and snippets.

@yasudacloud
Created April 7, 2023 13:17
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 yasudacloud/67c1c43b55be29b9d137d3be37d9c8a1 to your computer and use it in GitHub Desktop.
Save yasudacloud/67c1c43b55be29b9d137d3be37d9c8a1 to your computer and use it in GitHub Desktop.
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