Issue
I searched about [How to use qs in react] but can't find the answer.
Qs's official site https://www.npmjs.com/package/qs Usage
qs = require('qs');
var assert = require('assert');
var obj = qs.parse('a=c');
assert.deepEqual(obj, { a: 'c' });
var str = qs.stringify(obj);
assert.equal(str, 'a=c');
But I never see require()
used in react.
Does anybody know this answer?
I need this for passing array parameter in axios.
Solution
I had this identical problem in my React.
This would work:
const qs = require('qs')
This wouldnt work:
import qs from 'qs'
I solved it by deleting the "@types/qs" section from my package-lock.json, then running
npm install
Answered By - Sean M Answer Checked By - Pedro (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.