Hello Everyone!
Please help me! I am trying to do the PetLover project with React Router. I am stuck on step 5. It said: " Wrap your HomePage
component in a Route
component. The Route
should have a path
prop of /:type
so that the home page will render the species specified by the value of the URL parameter."
That is what I have done!
<Router>
<Navigation />
<Route path='/:type'>
<HomePage />
</Route>
</Router>
But then, it shows an error “A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .”
Therefore, I do what the error says.
<Router>
<Navigation />
<Routes>
<Route path='/:type'>
<HomePage />
</Route>
</Routes>
</Router>
But then it appears a new error: “[HomePage] is not a component. All component children of must be a or <React.Fragment>”
And, Here is where I am stuck. please help!
Thank you!