Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a fix for issue #6
Directly attaching a handler that calls setState will trigger this error. In my case using reactstrap’s
<Modal>
(https://reactstrap.github.io/components/modals/)Example:
where this.toggleModal() is calling* this.setState()
Issue #6 in Yellowbox hides the source of the problem, in this case directly calling the Modal.toggle handler when the component is mounting which causes a React.setStateLoopOfDoom error:
Screenshot:
This patch makes sure that this._listener.remove() is a function before trying to call it, thereby allowing the real problem (set state loop) to show up.
... sorry bout the .gitignore and yarn.lock mess.
*Not sure it matters but I’m using immer to set state: https://github.com/immerjs/immer#reactsetstate-example