reactjs - anti-pattern: updating (unrelated) state in a render() method -


i overriding recharts' tooltip functionality provide hover data elsewhere on page (in component).

<tooltip content={ this.showtooltipdata.bind(this) } /> 

showtooltipdata fires off action creator modifies part of state tree current render method not sensitive to, still dreaded anti-pattern warning:

warning: setstate(...): cannot update during existing state transition (such within `render` or component's constructor). render methods should pure function of props , state; constructor side-effects anti-pattern, can moved `componentwillmount`. 

this warning both correct , incorrect, rendering component not affected state change. reason care warning can spam console (there 10s of 1000s of points hover over).

is there better way this? have considered using the target hover data component's "private" state (as opposed redux state in use) need data elsewhere well. moving functionality componentwillmount() impossible.

anyone found safer way override tooltip function?

freakin' crickets. once time i'll take on redux...


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -