0

I want to use routing outside where the router object is created. How can I do that ?

<div className="col-sm-2 hidden-xs sidebar-container-wrapper"> <Sidebar currentUrl={currentUrl}/> </div> <div className="col-sm-10 col-xs-12 groups-container-wrapper"> <Provider store={ this.myStore }> <Router history={ history } onUpdate={() => window.scrollTo(0, 0)}> { routes } </Router> </Provider> </div> 

1 Answer 1

1

Programmatically push state. Or, put the links under Router to use Link...

Also, the HoC is available for newer versions.

Sign up to request clarification or add additional context in comments.

3 Comments

I am using Link in sidebar which needs color change on route change. How to handle this
If you're using redux, you can use something like react-router-redux to put the route info in redux store so you can connect() your sidebar and receive the update from there. Or, again the most common way is to put the sidebar in a "shell" component to render the main content and the sidebar both where child route dictates which component to be mounted for the main content that the shell component renders.
can i use Link using connect in my component ?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.