Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

javascript - Passing parameters in dynamic link in arbitary order reactjs router

I am using Router to make dynamic links to a spesific page in reactjs

<Route path ="/editQuestions/" component ={EditQuestions}/>

what I want to do is to add two parameters , termId and questionId but in arbitary order for example I want the page with /editQuestions/termId/3/questionId/4 to display the same content as the page /editQuestions/questionId/4/termId/3 and I do not want to add two addition router elements , In addition to that I want the page to make default values to questionId , termId when they are not passed for example when using a link /editQuestions/ I want it to display a page that ask the user to enter questionId and termId

conclusion : what I want to achieve is that modify the Route element so that it can accepts any number of the parameters in any order given without adding many otherRoute elements so that I keep my code elegant

question from:https://stackoverflow.com/questions/65941936/passing-parameters-in-dynamic-link-in-arbitary-order-reactjs-router

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...