REACT Best Practices Writing Clean code - AndelaOSP/Andela-Socials GitHub Wiki

Writing cleaner code using ES6 Features

Writing cleaner code will make it easier to understand and maintain the code. ES6 features will give us much cleaner way of writing code in React.

  1. Use Destructuring & spread attributes:

Avoid this.

image

Instead do this.

image

  1. Use Arrow functions

Avoid this:

image

image