Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Avoid re-creating functions on every render #10
Previously, the project created anonymous or new functions via bind inside of several render methods. This is hard for React to optimize since the function references will change on every tick of the component life-cycle i.e, React will have to assume that the component changed and re-render it on every cycle which leads to poor performance.
One clean way to solve the this-context and anonymous functions problem at the same time is to use methods at the class level which will automatically preserve the correct this-context while also being constant method references i.e., easy for React to optimize.
You can learn more about this approach in this great article by FreeCodeCamp.