In my project I have table, each row has his own class depends on state. I also have sticked columns so when I do horizontal scroll then some columns are fixed.
My problem is that when some state is changing (eg. from none
to rejected
) i need to mark this row as rejected
className and change background color.
Using setState
is problematic because whole row is rerendered so my sticky columns are gone (I do calculations on every scroll
event).
The question is: is there any other solution to change react className
without rerendering my row? (besides jQuery)
Change the state in your Row component so that the class is updated. Then, use PureComponent (https://github.com/facebook/react/pull/7195) on your child components so that they will not rerender unless their own props changed. Does that solve your problem?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With