I was wondering how I would be able to use query-string npm package to ease my axios calls. The package I use is: https://www.npmjs.com/package/query-string
An example:
import qs from 'query-string';
import axios from 'axios';
axios.get(`http://localhost:3000/api/products${qs.parse({ offset: 0, limit: 12 })}`);
Not sure why but this does not work as expected.
parseparses an existing query string into the corresponding data structure - you want the opposite, you want to create the query string from your data structure. The method to do that, isqueryString.stringify.