@app-studio/react-request
TypeScript icon, indicating that this package has built-in type declarations

0.0.57 • Public • Published

React Request

npm version npm License: MIT styled with prettier

✨ Features

📦 Install

npm install react-request --save

🔨 Usage

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);
};

TypeScript

react-request is written in TypeScript with complete definitions.

🔗 Links

🤝 Contributing PRs Welcome

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.

Let's fund issues in this repository

❤️ Sponsors and Backers

Author

SteedMonteiro, steed@rize.network

License

React Request is available under the MIT license. See the LICENSE file for more info.

Package Sidebar

Install

npm i @app-studio/react-request

Weekly Downloads

11

Version

0.0.57

License

MIT

Unpacked Size

343 kB

Total Files

22

Last publish

Collaborators

  • steed