npm install react-request --save
import {useRequest, UseRequestOption} from "react-request";
export const postDataRequest = (
requestBody?: DataBody,
): Promise<Data> => {
return await fetch({
method: 'POST',
path: `/api/data`,
body: requestBody,
});
};
export const usePostDataService = (
options: UseRequestOption = {},
): {
run: (requestBody?: DataBody) => void;
data: any;
loading: boolean;
error?: Error;
params?: any;
} => {
return useRequest(postDataRequest, options);
};
react-request
is written in TypeScript with complete definitions.
- Change Log
- Versioning Release Note
- FAQ
- CodeSandbox Template for bug reports
- Customize Theme
- How to Apply for Being A Collaborator
Read our contributing guide and let's build a better rize-network together.
We welcome all contributions. Please read our CONTRIBUTING.md first. You can submit any ideas as pull requests or as GitHub issues. If you'd like to improve code, check out the Development Instructions and have a good time! :)
If you are a collaborator, please follow our Pull Request principle to create a Pull Request with collaborator template.
SteedMonteiro, steed@rize.network
React Request is available under the MIT license. See the LICENSE file for more info.