开源软件名称(OpenSource Name):marcin-piela/react-fetching-library开源软件地址(OpenSource Url):https://github.com/marcin-piela/react-fetching-library开源编程语言(OpenSource Language):TypeScript 98.4%开源软件介绍(OpenSource Introduction):Simple and powerful fetching library for React. Use hooks to fetch data! react-fetching-libraryUse 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. DocumentationFull documentation is available HERE Short example of useimport { useQuery } from 'react-fetching-library';
const fetchUsersList = {
method: 'GET',
endpoint: '/users',
};
export const UsersListContainer = () => {
const { loading, payload, error, query } = useQuery(fetchUsersList);
return <UsersList loading={loading} error={error} users={payload} onReload={query} />;
}; Typescript supportInspirationsContributingFeel 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 dataFor now React Suspense is not production ready to use it for fetch data as described here, so API of our component/hook may change in the future. Licensereact-fetching-library is licensed under the MIT license. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论