Replies: 1 comment
-
Suggest you check how many times ComparePreviousAndGetStyle is being run. You are not using state to hold values between renders, and your useEffect has no dependencies, so useEffect will overwrite previous value with current if it is called twice on same cell. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
As I'm moving from the V7 version, I've faced an issue.
Dynamic cell formatting based on cell value is a feature that is vital for some columns I have. To be precise, I'm trying to compare previous cell value (number) with a new one, and
However, after adjusting code to V8, what is happening, is that the text-color stays with the initial value (""). Even though while debugging I can see that the variable is changing, there is no reaction in the browser. className stays set to the initial value which is "" or whatever I change it to.
With V7 the way to go would be:
Which I moved to:
and
My first thought was that there's an issue with usage of hooks, so I simplified the implementation.
I based the className value on a simple condition:
Even after that, the value gets initial formatting and stays with it.
E.g. something that was greater or equal as 0 gets formatted as green, and it stays green, even, if the value of the cell gets lower than 0.
Would anybody recommend something for that?
Beta Was this translation helpful? Give feedback.
All reactions