This community-built FAQ covers the “Nested Routes” exercise from the lesson “React Router”.
Paths and Courses
This exercise can be found in the following Codecademy content:
(Beta) Learn React Router
FAQs on the exercise Nested Routes
There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
You can also find further discussion and get answers to your questions over in Language Help.
Agree with a comment or answer? Like () to up-vote the contribution!
Need broader help or resources? Head to Language Help and Tips and Resources. If you are wanting feedback or inspiration for a project, check out Projects.
Looking for motivation to keep learning? Join our wider discussions in Community
Learn more about how to use this guide.
Found a bug? Report it online, or post in Bug Reporting
Have a question about your account or billing? Reach out to our customer support team!
None of the above? Find out where to ask other questions here!
This section doesn’t seem to work, either…
The username doesn’t appear to be set properly as all I see after clicking Profile is this:
To investigate, I dumped the value of
currentUser within Profile.js to see what the value was:
It seems the username isn’t there:
Hi there, I’ve done some digging around and was able to replicate your error if I didn’t update the Header.js file with
NavLinks to replace the
a tags — specifically, if link that redirects to
/profile is an
a tag, it will cause the page to reload, thus losing the username that you had entered.
If you include
NavLinks instead of
a tags, you will get the desired behavior ONLY if you click on the profile button. Even if you have the proper NavLinks, if you were to enter your username and then manually navigate to
/profile in the URL bar, you would lose the username. Why? Because this application is quite simple in the way it “signs users in”. Unlike more realistic sign-in features, this application simply stores the username in the browser’s memory which gets wiped when you refresh the browser which, as we learned, happens when you click on an
<a> tag or if you navigate to a URL in the browser. In a more realistic application, when a user signs in, that data would be stored in some back-end service or in the browser’s cache (or something like that).
I hope this helps!
I’d like to add that, as someone who had the same problem, the reason I had not replaced the profile
NavLink is because the comments in the file or the instructions on the module say to replace “the four a components” with navlinks. In reality there are 5 such components, so I made a best guess as to which one I was not (or not yet) supposed to replace, and chose not to replace the profile link. In reality it is fine and maybe necessary to replace every
a in header.js with a
I’ve been tripped up many times by errors such as this in Codecademy assignments.
My EditProfileForm is not rendering when click the button Edit. Why is that?
It goes straight to the article page and not the edit form.
When i click on edit then the edit form does not get rendered. It goes to blank page and profile name get disappeared.
Can someone please explain this to me? will be really appreciated