- Install the Library
npm i react-query - In the root folder, create ajsconfig.json file for absolute imports configuration:
{
"compilerOptions": {
"baseUrl": "src"
},
"include": ["src"]
}-
In our
index.jsfile, let's wrap our App component with QueryClientProvider component fromreact-queryto provide QueryClient object to our app. -
Now, let's install axios.
npm install axios -
Inside the folder called data under the src folder, create a file called
constants.jsthat contains the code below:
export const REQUEST_TIMEOUT_SECONDS: Number = 30;
export const JSON_PLACEHOLDER_ENDPOINTS: Object = {
LIST_OF_POSTS: "/post",
};