React ES6
What is ES6?
ES6 stands for ECMAScript 6. ECMAScript is a JavaScript standard intended to ensure a common language across different browsers. ES6 is the 6th version of ECMAScript.
Why ES6? / Features of ES6 / Upgrades in ES6
React uses ES6 and all of these new features will make your coding experience in react much much better. You will be able to do things with much more ease and in very less lines! Features like:
- Arrow Functions:
or
- .map():
.map
can be used for alot of things, one of it's use case is, we can make any number of cards through loop and just put it in jsx, like this:
- Destructuring:
Old Way:
New Way:
- Ternary Operator: With this, you can write if/else conditions in one line. It's syntax is fairly simple like this:
Example:
- Spread Operator:
Output:
and many more like, classes, modules.
0 Comments