Skip to content

Suggestion: Do not call setState() inside render() #23

@tomduggan85

Description

@tomduggan85

this.setState({ error: false });

It looks like this.redirect can sometimes call this.setState, and this.redirect is currently being called from render(). This can lead to bad situations, because this.setState will trigger another render() - so you can wind up creating an infinite loop where render calls setstate, which calls render, which calls setstate, ...

If possible, it'd be best to move the setState() somewhere else so that it doesn't happen at render time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions