If I have a component using ActiveState mixin and some of its parents declare shouldComponentUpdate, the child won't update when active state changes.
This is not normal because usually parent's shouldComponentUpdate doesn't magically cut the child off updates. If child listens to some store and calls setState, it will be updated. But this is not the case with context.
Even if parent's shouldComponentUpdate implementation takes nextContext into account, it won't even get nextContext if it doesn't declare contextTypes itself. So basically, for ActiveState to work in a project that heavily uses shallow-comparing shouldComponentUpdate or something similar, all ancestors of ActiveState-using component need to also have ActiveState.
See this React issue and this fiddle.
Obviously it's a React's problem per se but since router relies on context so much, it's worth documenting.
If I have a component using
ActiveStatemixin and some of its parents declareshouldComponentUpdate, the child won't update when active state changes.This is not normal because usually parent's
shouldComponentUpdatedoesn't magically cut the child off updates. If child listens to some store and callssetState, it will be updated. But this is not the case withcontext.Even if parent's
shouldComponentUpdateimplementation takesnextContextinto account, it won't even getnextContextif it doesn't declarecontextTypesitself. So basically, forActiveStateto work in a project that heavily uses shallow-comparingshouldComponentUpdateor something similar, all ancestors ofActiveState-using component need to also haveActiveState.See this React issue and this fiddle.
Obviously it's a React's problem per se but since router relies on context so much, it's worth documenting.