Lesson 12 - Using withRouter instead of context
ZackWard opened this issue · 1 comments
ZackWard commented
My short story:
I'm learning react-router, so I follow the tutorial and learn about <Links>. They work great. Now I want to make them work with Bootstrap, but I need to add the active class to the <li> instead of the <a>. I try to implement my own version of <Link> that adds the class in the correct place. It works on a page refresh but not while navigating, because my custom <BootstrapLink> gets the router from the context but doesn't use the ContextSubscriber mixin. I Google. I find withRouter. I think maybe it would be nice for this to be in the tutorial. 😄
Hopefully this will save learners some time and googling.
ZackWard commented
Closing stale issues