I’m using React router, onClick of the dropdown value (which is multi selection) I’m trying to push value to the parameter, value I’m passing is an array but somehow in the URL it’s showing only a single value. How do I send multiple values as one parameter?
Could anyone suggest a solution?
var study_dashboard=['abc','xyz','pqr']
history.push(
`/dashboard/filter?name=${study_dashboard}`
);
Thanks
>Solution :
You could use JSON.stringify to convert the array into a JSON notation string.
var study_dashboard=['abc','xyz','pqr']
history.push(
`/dashboard/filter?name=${JSON.stringify(study_dashboard)}`
);