React – Tips on writing better code

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


Add a Comment

Your email address will not be published. Required fields are marked *

To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image