Month: April 2019

React Component: A pair of componentDidMount() and componentWillUnmount() may cause infinite loop if error is thrown from render

The following will cause an infinite loop. The render() method will be called again and again. class ToDoItemEditComponentContainer extends React.Component { componentDidMount() { this.props.loadItem(); //load item remotely and put it in the local redux store } componentWillUnmount() { this.props.clearItemLocally(); //remove item from local redux store } render() { throw “some error” } } Here is …

React Component: A pair of componentDidMount() and componentWillUnmount() may cause infinite loop if error is thrown from render Read More »