DEV Community

Breno Novelli
Breno Novelli

Posted on • Edited on

useQuery() with React Router Dom

import { useLocation } from 'react-router-dom'; const useQuery = () => new URLSearchParams(useLocation().search); let query = useQuery(); console.log(query.get('myquery'); 
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
thomasghenry profile image
Thomas G Henry

to the point! much appreciated!

Collapse
 
jontatan25 profile image
jontatan25

Thank you very much! after looking all over the internet this explanation is just perfect. Straight to the point.