1.02K viewsMern Amazona

“Uncaught Error: Cannot include a ‘?’ character in a manually specified to.pathname field [{“pathname”:”/search?category=all&query=all&price=all&rating=all&order=newest&page=1″}]. Please separate it out to the to.search field. Alternatively you may provide the full path as a string in and the router will parse it for you.
at invariant (utils.ts:756:1)
at resolveTo (utils.ts:851:1)
at hooks.tsx:307:1
at mountMemo (react-dom.development.js:17224:1)
at Object.useMemo (react-dom.development.js:17669:1)
at Object.useMemo (react.development.js:1649:1)
at useResolvedPath (hooks.tsx:307:1)
at useHref (hooks.tsx:61:1)
at LinkContainer (LinkContainer.js:48:1)
at renderWithHooks (react-dom.development.js:16303:1)”

This seems to be the line of code that isn’t working and I have attempted to change it multiple times, yet still receive error messages ..


This is the change I have made, to fix the error created by the ? in the previous line, but as you can see below I am now being given a routing error ..

`/search category: ${filterCategory}; query: ${filterQuery}; price: ${filterPrice}; rating: ${filterRating}; order: ${sortOrder}; page: ${filterPage}`;

I am now being presented with the following error:

utils.ts:767 No routes matched location “/search category: all; query: all; price: 51-200; rating: all; order: newest; page: 1”

The same error occurs no matter what I try to search for.

Is there any solution to this?

Bassir Changed status to publish March 10, 2023