Skip to content

Generic component for fetching and displaying data from remote servers

License

Notifications You must be signed in to change notification settings

javcasas/remote-data

Repository files navigation

remote-data in TypeScript

See Constructing a Generic Data Loader Component with good typechecking in Typescript

Usage

const CommentsSection = () =>
  <RemoteData
    dataFetcher={() => request(...)}
    notAskedUI={<div>No data has been fetched yet</div>}
    loadingUI={<div>Loading comments...</div>}
    failureUI={(error) => <div>An error happened loading data: {error}</div>}
    successUI={(comments) => <ul>{ comments.map(comment => <li>{comment}</li>) }</ul>}
    />

About

Generic component for fetching and displaying data from remote servers

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published