- I am trying to use router in my app
- so I used react-router-dom, but I am facing issues,
researched and found this link but still not helping me. Invariant failed: You should not use <Route> outside a <Router>
can you tell me how to use route and link
- i need to redirect to another page.
- providing my code snippet and sandbox below. https://codesandbox.io/s/still-smoke-uf731
let Channel = ({ channelName, channelString, onClick, active }) => (
<div onClick={onClick} className=" col-lg-2 col-md-4 col-sm-6 ">
<div>router</div>
<Router>
<Link to={"/here"}> here</Link>
<Switch>
<Route path="/auth" />
<Route path="/" />
</Switch>
</Router>
<div
className="channel-button"
style={{
backgroundColor: active === channelString ? "orange" : ""
}}
>
<p>{channelName}</p>
</div>
</div>
);