Skip to content

[react/destructuring-assignment] Shows weird behaviour when I declare a variable with the name context #2309

Closed
@roman-16

Description

@roman-16

In a functional component I get an error when I declare a variable with the name context.
Example code:

const Test = props => {
  const context = useContext(someContext);

  return (
    <div {...props}>
      {context.test} // Here message: 'Must use destructuring context'
    </div>
  );
}

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