DEV Community

loading...

useQuery() with React Router Dom

brenonovelli profile image Breno Novelli Updated on ・1 min read
import { useLocation } from 'react-router-dom';

const useQuery = () => new URLSearchParams(useLocation().search);

const { items } = useOrder();

let query = useQuery();

console.log(query.get('myquery');
Enter fullscreen mode Exit fullscreen mode

Discussion (1)

Collapse
thomasghenry profile image
Thomas G Henry

to the point! much appreciated!

Forem Open with the Forem app