Content-Length: 269556 | pFad | https://github.com/jsx-eslint/eslint-plugin-react/issues/3443

74 Allow nested destructuring with `react/hook-use-state` · Issue #3443 · jsx-eslint/eslint-plugin-react · GitHub
Skip to content

Allow nested destructuring with react/hook-use-state #3443

Closed
@philer-jambit

Description

@philer-jambit

State is not always flat and sometimes it can make sense to destructure it directly. Example:

const [{foo, bar, baz}, setFooBarBaz] = useState({foo: "omg", bar: "wtf", baz: "bbq"})
const [[index, value], setValueWithIndex] = useState([0, "hello"])

Note that in these cases the setter name can not be symmetrical to the destructured variables.

It would be nice if react/hook-use-state permitted this use case (maybe optional?).

Either way, thanks for the great work! 👍

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









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/jsx-eslint/eslint-plugin-react/issues/3443

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy