#Migrating from Next to Remix
1 messages · Page 1 of 1 (latest)
the useRouter equivalent is
const navigate = useNavigate()
oh also useLocation() for the location
You also use next/router to get the url params and such, those are divived between several react-router hooks, useLocation(), useParams(), useSearchParams()
useRouter does... a lot of stuff
thanks,
If I want to match pathname with a string to see if it is "active" what should I use? useLocation()?
I guess useMatch() might work here
generally if you want to do active styling you can use NavLink
yea I saw it but I want to use active to style a parent element
otherwise it’s best to do what NavLink does internally which is basically string matching on pathname
ok, string match with pathname using useMatch()? or get pathname from useLocation()?
can I style a parent element as active using NavLink? I don't think so
you can’t
let me get you the link to the NavLink source
it uses the useLocation pathname