This React app uses React Router to switch between Home, About, and a dynamic Profile page. The navigation links let you move between pages without reloading.
C. The <Route> for '/' should not have an element prop
D. Cannot use <Route> and <Routes> together
Solution
Step 1: Check component nesting rules
In React Router, all <Route> components must be children of <Routes>.
Step 2: Identify incorrect placement
The <Route path='/' ... /> is outside <Routes>, which is invalid.
Final Answer:
<Route> must be inside <Routes> -> Option A
Quick Check:
Routes wrap Route components [OK]
Hint: Always put <Route> inside <Routes> component [OK]
Common Mistakes:
Placing <Route> outside <Routes>
Thinking <Route> can be used alone
Confusing element prop usage
5. You want to create a navigation menu that changes the URL without reloading the page. Which React Router component should you use, and why?
Choose the best option.
hard
A. Use <Route> because it defines the navigation links
B. Use <a> tags because they are standard HTML links
C. Use <Link> because it updates the URL and renders the new page without reload
D. Use <BrowserRouter> because it creates the navigation menu
Solution
Step 1: Identify component for navigation links
<Link> is designed to change the URL and render new pages without reloading.
Step 2: Compare with other options
<a> causes full page reload, <Route> defines pages, and <BrowserRouter> wraps the app but does not create links.
Final Answer:
Use <Link> because it updates the URL and renders the new page without reload -> Option C
Quick Check:
Use Link for smooth navigation without reload [OK]
Hint: Use <Link> for navigation to avoid full page reload [OK]
Common Mistakes:
Using <a> tags causing full reload
Confusing <Route> with navigation links
Thinking <BrowserRouter> creates menus
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.