score:1
i found the answer to my question. i need to use the nextprops
argument and the method componentwillupdate
instead of the componentdidupdate
method.
// before
componentdidupdate() {
this.updateamout();
}
// after
componentwillupdate(nextprops) {
if (!_.isequal(this.props, nextprops)) {
this.updateamout();
}
}
score:6
each time you modify state in componentdidupdate
, a re-render is thrown asynchronously.
in your method updateamount
, you are modifying the state.
and you are calling that method in componentdidupdate
, so you initiate an infinite loop of re-renders, so this endless loop created finally wastes the javascript memory.
the react cycle when updating the state is the following one. so you can easily understand why you enter into an endless loop.
Source: stackoverflow.com
Related Query
- React native - Maximum call stack size exceeded
- Diagnosing RangeError: Maximum call stack size exceeded in React KeyEscapeUtils
- React boilerplate : Maximum call stack size exceeded
- react Maximum call stack size exceeded
- Maximum call stack size exceeded - Connected React Component
- Multiple Redux middleware causing Maximum call stack size exceeded
- Create React App : Range error - Maximum call stack size exceeded
- Uncaught RangeError Maximum call stack size exceeded in React App
- npm ERR! Maximum call stack size exceeded while creating a react project using create-react-app
- Don't know why i get React Maximum call stack size exceeded
- React - Maximum call stack size exceeded
- React Router, maximum call stack size exceeded
- Uncaught RangeError: Maximum call stack size exceeded in React
- React Router (entering infinite Loop) :Uncaught RangeError: Maximum call stack size exceeded
- redux (RangeError): Maximum call stack size exceeded
- React js RangeError: Maximum call stack size exceeded
- React For Loop - Uncaught (in promise) RangeError: Maximum call stack size exceeded
- React, Uncaught RangeError: Maximum call stack size exceeded
- Material-UI: Uncaught RangeError: Maximum call stack size exceeded
- Eslint - Maximum call stack size exceeded
- Maximum call stack size exceeded React-Redux
- react-redux RangeError: Maximum call stack size exceeded
- React: Uncaught RangeError: Maximum call stack size exceeded
- nextjs RangeError: Maximum call stack size exceeded
- React Router onEnter Function "Uncaught RangeError: Maximum call stack size exceeded"
- RangeError: Maximum call stack size exceeded (getting this error on multiple async/await calls)
- Maximum call stack exceeded error in React
- MouseEvent<HTMLElement> giving error Maximum call stack size exceeded
- Uncaught RangeError: Maximum call stack size exceeded - ReactJS
- Maximum call stack size exceeded - reactjs
More Query from same tag
- React ESLint error at line that doesn't exist
- server errors using express in a React project
- how to consume multiple context in reactjs
- Should I use setState conditional updates in componentDidUpdate in React 16?
- Why does styling a Bootstrap modal with dialogClassName set and using Styled JSX require the global tag?
- State object structure in react-redux application
- Default.a.map is not a function in react
- Cannot link to index.js(main page) of next.js app
- How to create a loop with wheel picker in ReactJs
- Funtions with two parameter not working in React
- Need help writing a function to return an empty array if key doesn't exist as a within objects inside of an array
- How to update a specific object within storage with React/Redux?
- Memory Router doesn't use the browsers back button
- problem with selector in react.js . If i use selector in react.js and if i export in one of the component it shows error in that selector part
- ReactJS TypeError: _this3.onDismissID is not a function
- Issue with async default value in React Material UI Autocomplete
- Edited: How to use the switch using Bootstrap className?
- React state not displaying appropriately
- Next JS - Navbar onclick function undefined
- Uncaught TypeError: Cannot read properties of undefined (reading 'ha')
- how to syncState to firebase with re-base?
- Create React app with React-Snapshot Pre-Rendering static files
- How to use conditional rendering in reactjs?
- React Material UI can't find mobile device on first render
- Testing React Apps with Phantom/Casper
- Passing Props in Context [React]
- reactjs setState doesn't change properly
- Why can't I recover selected items from a React Dropdown Tree Select
- Can't get Params from id routes
- How to trigger the useCallback in React