React router best practice
Im new to react router, I want to pass state down to my components that are in different URL paths
This is the file I'm stuck with,
Here, I have created the
I'm asking because in the react router docs tutorial, they created the router outside the component. But this way, I cannot access state variable and pass them as props.
So once again, is it okay to create a router from
This is the file I'm stuck with,
App.tsxHere, I have created the
router from createBrowserRouter inside my App react component, is this allowed, is it fine?I'm asking because in the react router docs tutorial, they created the router outside the component. But this way, I cannot access state variable and pass them as props.
So once again, is it okay to create a router from
createBrowserRouter inside my component?