How to compare with previous value? #2436
Unanswered
antoine4444
asked this question in
General
Replies: 1 comment
-
I manage to do it with: const comparePrevious = currentValue => {
const prevValueRef = useRef(0);
useEffect(() => {
prevValueRef.current = currentValue;
});
const prevValue = prevValueRef.current;
return currentValue >= prevValue ? (
<span style={{ color: "blue" }}>{currentValue}</span>
) : (
<span>{currentValue}</span>
);
}; and Cell: cell => comparePrevious(cell.value) But not sure it's the right way to do it 🤔 |
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.
-
I would like to compare my new cell value, with the previous one to customize the CSS of the new value.
But I currently struggling with how to access the previous value of a cell.
Beta Was this translation helpful? Give feedback.
All reactions