docs: updated docs

This commit is contained in:
arthurfiorette 2022-01-20 08:52:44 -03:00
parent b76087ed27
commit 95f4137cfd
No known key found for this signature in database
GPG Key ID: 9D190CD53C53C555

View File

@ -73,9 +73,8 @@ const { setupCache } = require('axios-cache-interceptor');
const api = setupCache(
Axios.create({ baseURL: 'https://jsonplaceholder.typicode.com/' }),
{
ttl: 5 * 1000 // 5 seconds
}
// 5 seconds
{ ttl: 5 * 1000 }
);
// Every time an api call reaches here, it will
@ -130,7 +129,10 @@ function Component() {
// React component state (but can be from any other framework, library and etc)
const [data, setData] = useState(null);
// Calling this function every component redraw does not have any problems. As the response is cached in the first request. This even work with concurrent requests and for many components at the same time
// Calling this function every component redraw does not have any
// problems, as the response is cached in the first request. This
// even work with concurrent requests and for many components at
// the same time
axios.get('https://api.example.com').then((response) => {
setData(response.data);
});