Relative Content

Tag Archive for javascriptreactjsreact-router

how to get username input into welcome page message [duplicate]

This question already has answers here: How to pass data from a page to another page using react router (5 answers) Closed 5 mins ago. This post was edited and submitted for review 18 secs ago. I am making a multi-page Online Store web application and I currently stuck on how I pass the user’s […]

how to pass username into welcome message after logging in in React.js

I am making a multi-page Online Store web application and I currently stuck on how I pass the user’s input (username) into the welcome message that will show up after logging in such as “weclome back {username}” I am new to react.js so I am trying to keep it simple so I tried to useLocation but it was unsuccessful I was wondering I needed to rewrite my coded or i was thinking to use props? please help??

Why does the React Router’s element use an arrow function to refresh the page more than once

<Route key={fullPath} path={fullPath} element={ <PageWrap singePage={singlePage} item={route}> {element} </PageWrap> } /> const Component = () => ( <PageWrap singePage={singlePage} item={route}> {element} </PageWrap> ); <Route key={fullPath} path={fullPath} element={<Component />} /> When I use the following script, when I refresh the page manually, the page will load one more time than the above script。I don’t understand I […]