useParams arguments no longer optional
I was using the beta version 169, and I was able to get the current path parameters with
const params = useParams(). After bumping to version 179, this function call is no longer valid. Reviewing the code, it looks like opts was changed from optional to required. Was this intentional? If so, what is the new syntax if I just want to get the current matching parameters of a page?3 Replies
exotic-emerald•3y ago
Where are you getting useParams? Export? route.useParams? Component props?
passive-yellowOP•3y ago
exotic-emerald•3y ago
Yeah that wasn’t type safe until now.
If you know the route it’s being called inside of, provide the “from” option to it. If you don’t know, pass the “strict: true” option.