Skip to content

Instantly share code, notes, and snippets.

View luyx2412's full-sized avatar
🎯
Focusing

luyx2412 luyx2412

🎯
Focusing
View GitHub Profile
@luyx2412
luyx2412 / ...txt
Last active June 29, 2018 10:54
improve performance note React Native
- Should be use PureComponent to avoid re-render many times --> https://reactjs.org/docs/react-api.html#reactpurecomponent
- Seperate Container file and Component file --> https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0
- Avoid use .bind when handle function --> https://stackoverflow.com/a/32192892/6622971
- Don’t use arrow functions in your render methods --> onPress={(e) => this.handlePress(e)} --> only use when need pass params to handle, or
export default ({deleteItem, item}) => {
const _onDeleteTap(){
deleteItem(item.id)
}
return(
<TouchableOpacity onPress={_onDeleteTap}>