Skip to content

New rule suggestion: no-access-state-in-setstate #172

Closed
@zerkms

Description

@zerkms

This is the same as https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-access-state-in-setstate.md

The purpose: to deny using this.state inside this.setState call.

Why: Given this.setState mutates the state asynchronously it's extremely easy to introduce a subtle bug when in 2 sequential calls one relies on a particular this.state state. And if those this.setState calls are in different functions and spatially not even close the problem might be really challenging to debug.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions