Material-UI: too many re-renders. The layout is unstable.
See original GitHub issue- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
When typing a large input into a <TextField>
, eventually the following error pops up in the console
Material-UI: too many re-renders. The layout is unstable.
TextareaAutosize limits the number of renders to prevent an infinite loop.
Expected Behavior 🤔
For this to not happen
Steps to Reproduce 🕹
Just type a lot into the <TextField>
.
Context 🔦
Just trying to write a long input into <TextField>
.
Your Environment 🌎
Tech | Version |
---|---|
Material-UI | v4.9.5 |
React | 16.13.0 |
Browser | Firefox 74 |
TypeScript | 3.8.3 |
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Material-UI: Too many re-renders. The layout is unstable ...
After some 10 or more 'onChange' happen, I get this error on the console: Material-UI: Too many re-renders. The layout is unstable.
Read more >How to solve too many re-renders error in ReactJS?
“Too many re-renderers” is a React error that happens after you have reached an infinite render loop, typically caused by code that in...
Read more >The error "Too many re-renders. React limits the number of ...
The issue is that the setCounter function gets invoked when the component renders, updates the state, which causes a re-render and does that...
Read more >[Resolved] Too many re-renders. React limits the number of ...
React limits the number of renders to prevent an infinite loop. React Modal too many re-renders; React setState too many re-renders; This issue ......
Read more >Too many re-renders React limits the number of ... - YouTube
how to solve Error: Too many re - renders. React limits the number of renders to prevent an infinite loop in react JS...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
having the same issue when using
<TextField multiline ...
so when the size changes vertically (from adding content to the input) i get this error i also noticed that it happens when controlled
codesandbox demo
using
@mui/material@5.16.1
andreact@18.1.0
I just now found a fix for this issue: It wasn’t caused by MUI but by my incorrect usage of react-hook-form.
I assumed using the register method like with native HTML
<input />
elements would work fine. With UI Libraries like MUI you should acutally use a Controller to wrap you form fields: