Below are some tips on writing better code in React.
1. Get some good linting. Use ES Lint, Airbnb’s JavaScript Style Guide, and ESLint React Plugin.
2. Use propTypes and defaultProps.
3. Know when to make new components.
4. Know when to write a Component, PureComponent, and a Stateless Functional Component.
5. Use React Dev Tools.
6. Use inline conditional statements in your code.
7. Use Snippet Libraries to save a ton of time that is usually wasted on boilerplate code.
8. Learn how React works with React Internals.
9. Use tools like Bit / StoryBook to improve your component development workflow