TanStackT
TanStack4y ago
8 replies
then-purple

Unexpected re-renders, notifyOnChangeProps question

Hi, i have a question about notifyOnChangeProps. Docs says that the default behavior is tracked, but I see some unexpected re-renders and I'm trying to understand why they are happening.

Please take a look at this example:
https://codesandbox.io/s/quizzical-montalcini-jm2dyf?file=/src/index.js

I expect to see 2 renders: first when data is
undefined
and second when the data comes from the queryFn. Somehow i see 3 renders and i can't understand why.
image.png
CodeSandbox
quizzical-montalcini-jm2dyf using @tanstack/react-query, react, react-dom, react-scripts
quizzical-montalcini-jm2dyf - CodeSandbox
Was this page helpful?