Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'callee' of null #2745

Closed
yankri opened this issue Aug 7, 2020 · 4 comments
Closed

TypeError: Cannot read property 'callee' of null #2745

yankri opened this issue Aug 7, 2020 · 4 comments

Comments

@yankri
Copy link

yankri commented Aug 7, 2020

Getting this error TypeError: Cannot read property 'callee' of null when calling forwardRef(this.ref)

componentDidMount() {
    const { forwardRef } = this.props;

    this.ref.current.focus();

    if (typeof forwardRef === 'function') {
      forwardRef(this.ref);
    }
}

Stack trace:
TypeError: Cannot read property 'callee' of null
Occurred while linting file
at Object.isDestructuredFromPragmaImport (/node_modules/eslint-plugin-react/lib/util/Components.js:348:33)
at Object.isPragmaComponentWrapper (node_modules/eslint-plugin-react/lib/util/Components.js:604:69)

We solved this by eliminating the props destructuring and using this.props.fowardedRef(this.ref) but this seems to be an issue with the package.

@ljharb
Copy link
Member

ljharb commented Aug 8, 2020

@yankri what version of eslint and eslint-plugin-react do you have installed?

@proxi
Copy link

proxi commented Aug 10, 2020

I am seeing similar crash with eslint 7.6.0 eslint-plugin-react 7.20.5:

    at Object.isDestructuredFromPragmaImport (/node_modules/eslint-plugin-react/lib/util/Components.js:348:33)
    at Object.isCreateElement (/node_modules/eslint-plugin-react/lib/util/Components.js:393:16)
    at Object.isReturningJSX (/node_modules/eslint-plugin-react/lib/util/Components.js:467:47)

@yankri
Copy link
Author

yankri commented Aug 10, 2020

@ljharb eslint 6.8.0 and eslint-plugin-react 7.20.5

@ljharb
Copy link
Member

ljharb commented Aug 12, 2020

This is solved by 8466625, which is currently unreleased. Duplicate of #2733.

@ljharb ljharb closed this as completed Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants