O'Reilly logo

React Native By Example by Richard Kho

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Writing in ES6

ECMAScript version 6 (ES6) is the latest specification of the JavaScript language. It is also referred to as ES2016. It brings new features and syntax to JavaScript, and they are the ones you should be familiar with to be successful in this book.

Firstly, require statements are now import statements. They are used to import functions, object, and so on from an external module or script. In the past, to include React in a file, we would write something like this:

var React = require('react'); var Component = React.Component; 

Using ES6 import statements, we can rewrite it to this:

import React, { Component } from 'react'; 

The importing of Component around a curly brace is called destructuring assignment. It's an assignment ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required