-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Labels
Description
Opening up this issue for discussion, maybe this could be interesting.
Enable to define different states and render them according to the current state.
Check this out example using Tasks f.e. https://codesandbox.io/s/vv92zqqz0l
const App = () => (
<Fetch
url="https://api.github.com/users/octocat"
timeout={5000}
>
{({ result }) => (
{result.cata(
{
notAsked: () => <div>Nothing Loaded</div>,
loading: () => <div>Loading...</div>,
error: error => <div>Something went wrong: {error}</div>,
success: ({ users }) => (
<ul>{users.map(user => <UserComponent key={user.id} {...user} />)}</ul>
)
})
)}
</Fetch>
);