Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Simple and powerful API client for react 👍 Use hooks or FACCs to fetch data in easy way. No dependencies! Just react under the hood.

License

NotificationsYou must be signed in to change notification settings

marcin-piela/react-fetching-library

Repository files navigation

Simple and powerful fetching library for React. Use hooks to fetch data!

Watch on GitHubStar on GitHubTweet


Build StatusversiondownloadsMIT LicensePRs WelcomeCode of ConductCode of Conductcodecov

✅ Zero dependencies (react, react-dom as peer deps)

✅ SSR support

✅ Use hooks or FACC's (Function as Child Components) - depending on your needs

✅ Uses Fetch API (but allows to use custom fetch implemenation and axios as well)

✅ Request and response interceptors allows to easily customize connection with API

✅ React Suspense support (experimental *)

✅ TypeScript support

✅ Error boundaries to catch bad API responses

✅ Less than 3k minizipped

✅ Simple cache provider - easily to extend

✅ Handle race conditions

✅ Allows to abort pending requests


react-fetching-library

Use hooks or FACC's (Function as Child Component) to fetch data in an easy way. No dependencies! Just React under the hood.

Request and response interceptors allows you to easily customize connection with API (add authorization, refresh token, cache, etc). It uses Fetch API so it can be used in SSR apps (i.e. with isomorphic-fetch).

Library allows you to use it with connection of React Suspense (read more about React Suspense) to easily maintain loading state in application.

Documentation

Full documentation is availableHERE

Short example of use

import{useQuery}from'react-fetching-library';constfetchUsersList={method:'GET',endpoint:'/users',};exportconstUsersListContainer=()=>{const{ loading, payload, error, query}=useQuery(fetchUsersList);return<UsersListloading={loading}error={error}users={payload}onReload={query}/>;};

Edit Basic Example

Typescript support

Inspirations

Contributing

Feel free to open PRs and issues to make this library better !

When making a PR, make sure all tests pass. If you add a new feature, please consider updating the documentation or codesandbox examples. Thank you!

Using Suspense to fetch data

For now React Suspense is not production ready to use it for fetch data as describedhere, so API of our component/hook may change in the future.

License

react-fetching-library is licensed under theMIT license.

About

Simple and powerful API client for react 👍 Use hooks or FACCs to fetch data in easy way. No dependencies! Just react under the hood.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors12


[8]ページ先頭

©2009-2025 Movatter.jp