I’m trying to learn react navigation, using route and route path but I seem to be making mistake somewhere, can anyone help me with it?
I tried to keep changing the div and the div that shows the posts but it doesn’t show anything now, it was showing the posts and the buttons but couldn’t go to Profile.js
Here’s the code from App.js for the function App :
function App() {
const [posts, setPosts] = useState([]);
usePostList(setPosts);
return (
<div className="App">
<div className="container">
{_renderJumbotron}
{_renderCard(posts)}
</div>
<Routes>
<Route path="/profile" Component={<Profile/>} />
</Routes>
</div>
);
}
export default App;
2
Answers
You need to change the Component to
element
Instead of component you should use element