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

JSX props should not use .bind() react/jsx-no-bind #729

Closed
hab1 opened this issue Jul 6, 2016 · 3 comments
Closed

JSX props should not use .bind() react/jsx-no-bind #729

hab1 opened this issue Jul 6, 2016 · 3 comments

Comments

@hab1
Copy link

hab1 commented Jul 6, 2016

When checking my files with npm run lint I get the following error :

\src\client.js 112:15
error JSX props should not use .bind() react-no-bind
? 1 problem <1 error, 0 warnings>

The line referring to this error ( render: render.bind(undefined, container, location.state ) ) :

UniversalRouter.resolve(routes, {
      path: location.pathname,
      query: location.query,
      state: location.state,
      context,
      render: render.bind(undefined, container, location.state),
    }).catch(err => console.error(err)); // eslint-disable-line no-console
  }

Any idea of why is this happening ?

Also, when I run "npm run lint" , at the end I get 2 errors with the code ELIFECYCLE :

node v6.2.2
npm v3.10.2
code ELIFECYCLE
@ eslint: eslint src tools
and
@ link: npm run eslint && npm run stylelint

Could this be related ?

@maullerz
Copy link

maullerz commented Jul 6, 2016

render: render.bind(undefined, container, location.state),

in this situation you can just disable eslint rule for this line
// eslint-disable-line react/jsx-no-bind

more about this rule here: rules/jsx-no-bind

@hab1
Copy link
Author

hab1 commented Jul 7, 2016

Thank you, for those who have the same problem, here is the solution.

    UniversalRouter.resolve(routes, {
      path: location.pathname,
      query: location.query,
      state: location.state,
      context,
      render: render.bind( // eslint-disable-line react/jsx-no-bind
        undefined,
        container,
        location.state
      ),
    }).catch(err => console.error(err)); // eslint-disable-line no-console

@hab1 hab1 closed this as completed Jul 7, 2016
@frenzzy
Copy link
Member

frenzzy commented Jul 10, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants