{"id":13422433,"url":"https://github.com/soroushchehresa/axios-react","last_synced_at":"2025-04-30T19:45:58.917Z","repository":{"id":53887228,"uuid":"181860528","full_name":"soroushchehresa/axios-react","owner":"soroushchehresa","description":"🌐 HTTP client component for React based on Axios","archived":false,"fork":false,"pushed_at":"2021-08-27T10:04:28.000Z","size":233,"stargazers_count":48,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-21T02:54:58.154Z","etag":null,"topics":["axios","axios-react","http","http-client","http-request","http-request-handler","http-requests","javascript","react","react-axios","reactjs","response-schema","typescript","xhr","xhr-wrapper"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/axios-react","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/soroushchehresa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-17T09:33:07.000Z","updated_at":"2025-02-16T17:18:35.000Z","dependencies_parsed_at":"2022-08-28T11:11:18.817Z","dependency_job_id":null,"html_url":"https://github.com/soroushchehresa/axios-react","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soroushchehresa%2Faxios-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soroushchehresa%2Faxios-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soroushchehresa%2Faxios-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soroushchehresa%2Faxios-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soroushchehresa","download_url":"https://codeload.github.com/soroushchehresa/axios-react/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251773495,"owners_count":21641642,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["axios","axios-react","http","http-client","http-request","http-request-handler","http-requests","javascript","react","react-axios","reactjs","response-schema","typescript","xhr","xhr-wrapper"],"created_at":"2024-07-30T23:00:44.849Z","updated_at":"2025-04-30T19:45:58.893Z","avatar_url":"https://github.com/soroushchehresa.png","language":"TypeScript","funding_links":["https://www.patreon.com/soroushchehresa"],"categories":["Code Design","HarmonyOS"],"sub_categories":["Props from server","Windows Manager"],"readme":"\u003cdiv align=\"center\"\u003e\r\n  \r\n# Axios React\r\n[![NPM](https://img.shields.io/npm/v/axios-react.svg)](https://www.npmjs.com/package/axios-react)\r\n[![NPM](https://img.shields.io/npm/dt/axios-react)](https://www.npmjs.com/package/axios-react)\r\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\r\n\r\nHTTP client component for React with child function callback to create async requests in render based on [Axios](https://github.com/axios/axios).\r\n\u003c/div\u003e\r\n\r\n\u003cbr\u003e\r\n\r\n## Installation\r\nYarn:\r\n```bash\r\n$ yarn add axios-react\r\n```\r\nnpm:\r\n```bash\r\n$ npm i -S axios-react\r\n```\r\n\r\n\u003cbr\u003e\r\n\r\n## Live example\r\n**[Online Playground](https://stackblitz.com/edit/react-2et9ls)**\r\n\r\n\u003cbr\u003e\r\n\r\n## Usage\r\n\r\n```jsx\r\nimport React from 'react';\r\nimport Request from 'axios-react';\r\n\r\nconst Demo = () =\u003e (\r\n  \u003cRequest\r\n    config={{\r\n      method: 'get',\r\n      url: 'https://jsonplaceholder.typicode.com/todos/1',\r\n    }}\r\n  \u003e\r\n    {({ loading, response, error, refetch, networkStatus }) =\u003e (\r\n      \u003cdiv\u003e\r\n          {networkStatus \u0026\u0026 \u003cspan\u003e{networkStatus}\u003c/span\u003e}\r\n          {loading \u0026\u0026 \u003cspan\u003eLoading...\u003c/span\u003e}\r\n          {error \u0026\u0026 \u003cspan\u003e{error.response.data}\u003c/span\u003e}\r\n          {response \u0026\u0026 \u003ch3\u003e{response.data.title}\u003c/h3\u003e}\r\n          \u003cbutton onClick={refetch}\u003eRefetch!\u003c/button\u003e\r\n      \u003c/div\u003e\r\n    )}\r\n  \u003c/Request\u003e\r\n);\r\n```\r\n\r\n\u003cbr\u003e\r\n\r\n## Arguments\r\n| Name | Type | Description |\r\n| ---- | ---- | ----------- |\r\n| loading | boolean | Request loading. |\r\n| response | object | The response for a request contains the [Axios response schema](https://github.com/axios/axios#response-schema). |\r\n| error | object | The error for a request. |\r\n| refetch | function | Refetch method for a request. |\r\n| networkStatus | string | Network Connection Status. |\r\n\r\n\u003cbr\u003e\r\n\r\n## Props\r\n\r\n| Name | Type | Default value | Options | Description |\r\n| ---- | ---- |------ | ------------- | ----------- |\r\n| config | object | None | [Axios request config options](https://github.com/axios/axios#request-config) | Config options for making requests. |\r\n| skip | boolean | false | true or false | Disable sending requests when mounting the component. |\r\n\r\n\u003cbr\u003e\r\n\r\n## Read more\r\n- [The easiest way to create HTTP requests in React.js](https://medium.com/@soroushchehresa/the-easiest-way-to-create-http-requests-in-react-js-6fa4b1819b3c)\r\n\r\n\u003cbr\u003e\r\n\r\n## Support\r\n\u003ca href=\"https://www.patreon.com/soroushchehresa\"\u003e\r\n  \u003cimg src=\"https://c5.patreon.com/external/logo/become_a_patron_button@2x.png\" width=\"160\"\u003e\r\n\u003c/a\u003e\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoroushchehresa%2Faxios-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoroushchehresa%2Faxios-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoroushchehresa%2Faxios-react/lists"}