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

Categories

0 votes
3.8k views
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:

Route::get('/cars/colors/{nr}/list/{listNr}/item/{id}',....

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

2.1m questions

2.1m answers

63 comments

56.6k users

...