Last active
July 21, 2017 21:26
-
-
Save glortho/5acfa73fc11dbae42c21dd3fb5810fee to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import React from 'react'; | |
import { Api } from 'jetset'; | |
function Users({ users }) { | |
return ( | |
<div> | |
{ users.list().isPending ? | |
<span>Loading...</span> | |
: | |
<span> | |
{users.list().data.map(({ data: user }) => | |
<div key={ user.get( 'id' ) }> | |
<span>{ user.get( 'name' ) }</span> | |
</div> | |
)} | |
</span> | |
} | |
</div> | |
); | |
} | |
export default function ApiImmutableExample() { | |
return ( | |
<Api immutable={ true } url="https://jsonplaceholder.typicode.com" users="/users"> | |
<Users /> | |
</Api> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment