react-spectrum
react-spectrum copied to clipboard
Issues with useTreeData hook
when I try to append or perform any adding function to a node in my tree, It adds double of the intended items to add. I see it through the console logs using tree.getItems(key). And under the children of a node I can only see the first added item even though I try to add multiple times it shows be only the first one I added. what could be the issue? no issues in adding to the root of the tree only to a node.
I use nextjs and the only way I could resolve it was by adding: reactStrictMode: false in the next.config.js as by default from next.js 13.4, the strict mode is true.
Please always include example code when reporting an issue.
You are not using React properly. Render functions can get called an arbitrary amount of times, and therefore mutating global objects in them is forbidden.
Strict mode just calls every render function twice.
I suggest to read all the React docs in detail, starting from Keeping Components Pure – React. Then consider whether you need useEffect, useMemo or something else entirely.
This is not a React Aria issue.