In my NextJS
application, I have implemented a catch all route that uses the following code:
import { useRouter} from 'next/router'
This code snippet retrieves all the parameters from the URL path:
const { params = [] } = router.query
When I console log the params
value, I can see all the URL path elements.
My goal is to display all the params
values in an unordered list:
return <ul>
{params.map((param) => {
<li>{param}</li>
})}
</ul>
However, when I try this code, nothing gets displayed. The list is empty.
How can I modify this to successfully display the list of parameters?