Should I learn ES6 before learning ReactJS?
No, you don’t have to learn es2015/es6 to learn react. But you may find many resources or React ecosystem uses ES6 extensively. Let's see some of the frequently used ES6 features,
-
Destructuring: To get props and use them in a component
// in es 5var someData = this.props.someData;var dispatch = this.props.dispatch;// in es6const { someData, dispatch } = this.props; -
Spread operator: Helps in passing props down into a component
// in es 5<SomeComponent someData={this.props.someData} dispatch={this.props.dispatch} />// in es6<SomeComponent {...this.props} /> -
Arrow functions: Makes compact syntax
// es 5var users = usersList.map(function (user) {return <li>{user.name}</li>;});// es 6const users = usersList.map((user) => <li>{user.name}</li>);
March 17, 2022
176
Read more
What is React?
November 06, 2022
ReactJSHow to programmatically trigger click event in React?
November 06, 2022
ReactJS