From 50c59fef25811036a78f06cabff797e2ccf1f881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Carmo?= Date: Sat, 4 Apr 2026 10:46:00 +0100 Subject: [PATCH] refactor: use functional setState to avoid stale state issues Replace direct state access with functional setState pattern to ensure state updates are based on the most current state value --- example/index.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/example/index.jsx b/example/index.jsx index 3305756..5d3482a 100644 --- a/example/index.jsx +++ b/example/index.jsx @@ -153,9 +153,9 @@ class AppDemo extends PureComponent { event.preventDefault() event.stopPropagation() - const { data } = this.state - - this.setState({ data: data.filter((r) => r._id !== row._id) }) + this.setState((prevState) => ({ + data: prevState.data.filter((r) => r._id !== row._id), + })) } getHeaders() {