Skip to content

Instantly share code, notes, and snippets.

View dmeehan1968's full-sized avatar

Dave Meehan dmeehan1968

View GitHub Profile
@dmeehan1968
dmeehan1968 / jsx-no-bind.md
Last active February 12, 2018 10:10
react/jsx-no-bind

ESLINT rule: react/jsx-no-bind

The problem

Arrow functions create a new function on every render, decreasing performance as a result of:

  • Addtional garbage collection
  • Passing changed props to components causing render to travel further into the graph

This is particularly evident when iterating over an array to generate components, which also need function props to handle state change as a result of user interaction, such as onClick/onPress.