You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I threw together some quick & dirty helper functions for modifying the "query string".
I'm not very familiar with this project, and I was wondering:
Question: Is the following approach is (broadly) aligned with the intended usage of this project?
importqsfrom'query-string';/** * Warning: I don't know if anything relies on query-string format, * but I will keep for convention */exportconstremoveQuery=(prevLocation={},history, ...queryKeys)=>{constlocation=Object.assign({},prevLocation);constsearchObj=qs.parse(location.search);queryKeys.forEach(q=>deletesearchObj[q]);location.search=qs.stringify(searchObj);history.push(location);};exportconstaddQuery=(prevLocation={},history,queryObj)=>{constlocation=Object.assign({},prevLocation);constsearchObj=Object.assign(qs.parse(location.search),queryObj);location.search=qs.stringify(searchObj);history.push(location);};exportconstgetQuery=(prevLocation={},queryKey)=>{constsearchObj=qs.parse(prevLocation.search);returnsearchObj[queryKey];};
Thanks
The text was updated successfully, but these errors were encountered:
Hi,
I threw together some quick & dirty helper functions for modifying the "query string".
I'm not very familiar with this project, and I was wondering:
Question: Is the following approach is (broadly) aligned with the intended usage of this project?
Thanks
The text was updated successfully, but these errors were encountered: