Skip to content

Bug: eslint-plugin-react-hooks "Cannot read property parent of null" #19810

@twavv

Description

@twavv

This seems to happen when

  1. I take a component as a prop
  2. I use that component as a JSX constructor in a hook

Minimal repro:

export const Foo = ({ Component }) => {
  React.useEffect(() => {
    console.log(<Component />);
  }, []);
};
    "eslint-plugin-react-hooks": "^4.1.1",

Interestingly, this does NOT cause the error:

export const Foo = ({ component }) => {
  React.useEffect(() => {
    const Component = component;
    console.log(<Component />);
  }, []);
};

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