Make `useRoute()` update in layout
Hi!
Im trying to use useRoute() in a layout, to update my navigations links based on the ´route.params.id´, but the route object does not update when going from page to page. How do i make the layout update the route object?
Any help is greatly appreciated.
Thanks
10 Replies
share a snippet of your code
Won't really help but sure.
![No description](https://cdn.answeroverflow.com/1225054362020089946/image.png)
converting links to a computed state should solve the problem. @Wicker answered you here https://discord.com/channels/473401852243869706/473406506579263488/1225043516317503538
Assuming it would look like this, i cant really answer you if i dont have the whole picture
something along those lines
@vinum, this is what you'd want to have;
Thanks guys, this worked perfectly
@pyplacca How do i use .map on the array? When it was not computed it worked fine but after it throws this error
links.map is not a function
. Thanksthe
.map
call should be on the array's square parenthesis
otherwise, you can do this; links.value.map
links is now a computed ref so it's value is returned from the value
propertyOnce again, you saved me 🙂
you're welcome