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

Add explanations and examples for .bind and arrow functions in render path in react components #2014

Conversation

Ensive
Copy link
Contributor

@Ensive Ensive commented Feb 24, 2019

I've deeply researched the topic regarding arrow functions and .bind usage within React components (specifically render path). This PR is my proposal to update the javascript styleguide (React page).
Let me know your thoughts.
Shall we split the example with appropriate usage of arrow functions into two:

  • within event handler (with focus on the need to pass event object to another function)
  • within .map or other cases (but in this case creating a separate function outside of render path is a better practice)

Any suggestions on editing are welcome.

Closes #1995

react/README.md Outdated Show resolved Hide resolved
react/README.md Outdated Show resolved Hide resolved
react/README.md Outdated Show resolved Hide resolved
@ljharb ljharb added the react label Feb 24, 2019
@Ensive Ensive force-pushed the enhance/add-explanations-and-examples-for-bind-and-arrow-functions-in-react-components branch 2 times, most recently from e954a7c to 2be0e89 Compare February 24, 2019 19:47
react/README.md Outdated Show resolved Hide resolved
react/README.md Outdated Show resolved Hide resolved
@Ensive
Copy link
Contributor Author

Ensive commented Feb 25, 2019

@ljharb
The recent review comments are addressed. Good addition 👍

@ljharb ljharb force-pushed the enhance/add-explanations-and-examples-for-bind-and-arrow-functions-in-react-components branch from 9fe63b2 to be07f7a Compare February 25, 2019 08:51
@ljharb ljharb merged commit be07f7a into airbnb:master Feb 25, 2019
@Ensive Ensive deleted the enhance/add-explanations-and-examples-for-bind-and-arrow-functions-in-react-components branch February 25, 2019 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants