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

How to resolve "react/jsx-no-bind" in Stencil context. #11

Open
frerepoulet opened this issue May 10, 2020 · 3 comments
Open

How to resolve "react/jsx-no-bind" in Stencil context. #11

frerepoulet opened this issue May 10, 2020 · 3 comments
Labels

Comments

@frerepoulet
Copy link

As per the recommendations on the stencil docs I use the binding/arrow function quite often on elements. What would be the best way to resolve the "react/jsx-no-bind" rule. I have seen their documentation but I can't seem to understand how the solutions could be applied in the context of Stencil components. This rule has been added intentionally to the stencil rules so I assume there is a solution to this, I just can't find it.

let item = "value";
<div onClick={() => self.select(item)}</div>

warning JSX props should not use arrow functions react/jsx-no-bind

@kasitmp
Copy link

kasitmp commented Aug 26, 2020

Would this maybe work for you?

private select = (item) => {
...
}

render () {
let item = 'value';
return <div onClick={this.select(item)} />
}

@ionitron-bot
Copy link

ionitron-bot bot commented Oct 12, 2021

Thanks for the issue! This issue is being closed due to inactivity. If this is still an issue with the latest version of Stencil, please create a new issue and ensure the template is fully filled out.

Thank you for using Stencil!

@ionitron-bot ionitron-bot bot closed this as completed Oct 12, 2021
@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Oct 12, 2021
@rwaskiewicz
Copy link
Contributor

Ah, some of these issues are so old that they're getting cleared automatically. Sorry about that!

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

No branches or pull requests

3 participants