Technetium 101(React Native): Performance Optimization
This article will offer a list of suggestions for optimizing performance while building a React Native app 1. Avoid use inline functions directly as props to a component & also avoid inline styling class Foo extends Component { render ( ) { return ( < button onClick = { ( ) => console . log ( 'boop' ) } > { /* 🙅♀️ */ } BOOP </ button > ) ; } } class Foo extends Component { handleClick = ( ) => { // this anonymous function is fine used like this console . log ( 'boop' ) ; } render ( ) { return ( < button onClick = { this . handleClick } > { /* 🙆♂️ */ } BOOP </ button > ) ; } } onPress contains an arrow function , a new reference to that inline function is declared in every render . It is not recommended that way. Causing an unnecessary re-render computation. use StyleSheet for styles ref https://medium.com/corebuild-so...