DEV Community

Discussion on: I've released over 100 apps in React Native since 2015, Ask Me Anything!

Collapse
 
kylessg profile image
Kyle Johnson • Edited

Always make sure that your messages are only rendering once (unless there’s a legitimate reason to update it) github.com/kyle-ssg/react-native-r... pop this into your message component to validate that it stays at 1.

Also check it any other expensive components are rendering as a result on your page. You should aim for a new message to not cause any other components to render. A mixture of keys, purecomponent/shouldcomponentupdate should help here.

Don’t declare functions in the render function if you can avoid it, do this.funcName.

If you’re getting 100s of simultaneous messages updating render state, consider denouncing the render perhaps. So 10 messages in 100ms only calls setstate once.