I need to extract filter which is an array of objects from a URL string:
http://localhost:3006/menus?page=1&filter[0][id]=MenuID&filter[0][value]=2&filter[1][id]=ParentMenuName&filter[1][value]=u.
This is currently what I have:
const location = useLocation();
const searchParams = new URLSearchParams(location.search);
const filterParamsValue = searchParams.getAll('filter'); // returns []
This is what I want to get from the filter:
[ { id: 'MenuID', value: '2' }, { id: 'ParentMenuName', value: 'u' } ]