Comments (4)
Everytime the setState runs the component is
rerendered and goes on on a infinite loop. Maybe
you can use useMemo hook? So the setState
does not run on every rerender??
from react.
@Harikrishnaselvam No, this is a false positive error. The effect is only running once, and it was introduced recently, probably with the devtools update. We're also experiencing the same calling setState in a requestAnimationFrame, and we do need all those setState calls to update the UI. Could be done differently? Yes, but that won't change the fact that the error is a false positive that wasn't an error before.
from react.
In my case this is something specific to rendering being expensive enough that it somehow confuses itself into thinking that there's recursion going on. In my real case, I have a somewhat complex component that's updated on every frame (sorry, I need the animation), and one of its parts uses setEffect for a simple operation.
from react.
Out of curiosity, as my team experienced something similar recently - what happens if you replace your useState()
with useReducer()
?
from react.
Related Issues (20)
- Bug: [React 19] Cannot read properties of undefined (reading 'ReactCurrentBatchConfig'
- [DevTools Bug]: Firefox extension out of date (v6.0.0, 2024-09-26) HOT 1
- Bug: eslint-plugin-react-hooks doesnt handle components starting with non-ASCII uppercase letter HOT 2
- [DevTools Bug]: Doesn't work in browser extensions
- [Compiler Bug]: some values set to undefined after optimization HOT 2
- Bug: eslint-plugin-react-hooks incorrectly flags useSomething() in loop, while allowing use() in React 19 HOT 2
- Bug: Why server action request use "content-type: text/plain", this will cause the default WAF rule block the request.
- Bug: suspense fallback flickers with nested suspended components HOT 1
- [React 19] renderToPipeableStream emits </html> in different order? HOT 2
- [Bug]: ERR_INVALID_ARG_TYPE occurs when I install project HOT 3
- [DevTools Bug]: HOT 1
- Bug: stylesheets that use precedence are significantly slower to render at scale HOT 3
- Bug: createRoot().render() is not fully synchronous unless wrapped in flushSync, unlike legacy ReactDOM.render HOT 2
- Bug: Sidebar Dropdown Does Not Collapse on Second Click in React Documentation HOT 5
- Bug: irregular behaviour of sidescroll when webpage zoomed-in HOT 3
- [DevTools Bug]: symbolicated sourcemaps won't fetch for rsc components on Chrome 135.0.7 (rsc:// and webpack:// prefixed fetches fail)
- [DevTools Bug]: Firefox devtools extension doesn't work with React 19 HOT 1
- [DevTools Bug] Cannot add node "909" because a node with that id is already in the Store. HOT 4
- Bug: button not working
- Test Issue from GitHub MCP Server
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react.