score:1

the most important thing to know when using react-router is that:

the path attribute defines the route url and component attribute defines the component for this route.

i would suggest having a read through this. best practice suggest, just like matt derrick suggested in the comments that the url should drive the rendering of components.

since you have acomponent and bcomponent that render based on the state i would suggest you then have 2 different urls to accompany that. so when state changes to be ==='a' then you will jump to /aurl, when the state changes to be ==='b' then you will jump to /burl.

hope this answers your question.


Related Query

More Query from same tag