You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
6. component continues to render with second state
1550
-
1551
-
now, in React 19 it looks like this:
1552
-
1553
-
1. render
1554
-
2. useState initializer
1555
-
3. strictMode: call useState initializer again
1556
-
4. component continues to render with one of these two states
1557
-
5. strictMode: render again
1558
-
6. component continues to render with the same state as during the first render
1559
-
1560
-
Since useQuery breaks the rules of React and mutably creates an ObservableQuery on the state during render if none is present, React 18 did create two, while React 19 only creates one.
1561
-
1562
-
This is pure coincidence though, and the useQuery rewrite that doesn't break the rules of hooks as much and creates the ObservableQuery as part of the state initializer will end up with behaviour closer to the old React 18 behaviour again.
0 commit comments