Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others


0 votes
in Technique[技术] by (71.8m points)

javascript - Map() a list of menu items in React JS

I am using InertiaJs in my application. Also i have a list of menu items on UI where i use React JS. I map() this list of items like :

items.map(i => {
  return <InertiaLink href={route(i.path, route().params)}>{i.name}</InertiaLink>

route().params return the params of the accessed route. The menu works, but appear an issue when from the last menu item i want to go to the 2-ond for example. In this way i can not go back and i stay on the actual menu item. The issue is that when i want to go back clicking to one of the item i all params from the last route which i access with route().params seems to want to be applied on the previous even i don't have these params on the previous route.
Ex: last route has next params:


So the nr, listNr and id will want to be applied to the previous menu item that i want to click.
Is somebody faced with the same issue and knows how t solve?

Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share