Skip to content

arman226/basic-implementation-of-react-query-with-axios

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React-query X Axios

INSTALLATION

  1. Install the Library npm i react-query
  2. In the root folder, create ajsconfig.json file for absolute imports configuration:
{
  "compilerOptions": {
    "baseUrl": "src"
  },
  "include": ["src"]
}
  1. In our index.js file, let's wrap our App component with QueryClientProvider component from react-query to provide QueryClient object to our app.

  2. Now, let's install axios. npm install axios

  3. Inside the folder called data under the src folder, create a file called constants.js that contains the code below:

export const REQUEST_TIMEOUT_SECONDS: Number = 30;

export const JSON_PLACEHOLDER_ENDPOINTS: Object = {
  LIST_OF_POSTS: "/post",
};

About

Using axios for API Requests and react-query as observer.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published