Skip to content

Commit

Permalink
Extends and class are no longer part of the example code 'above'. Add… (
Browse files Browse the repository at this point in the history
#2366)

* Extends and class are no longer part of the example code 'above'. Added the arrow function as an additional example

* use fix from the current docs

Co-authored-by: Bartosz Kaszubowski <[email protected]>
  • Loading branch information
magnusbrattlof and Simek authored Dec 5, 2020
1 parent 48e2417 commit 3e30040
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion website/versioned_docs/version-0.63/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ The following style is [`justifyContent`](layout-props#justifycontent): "center"

Some of the things in here might not look like JavaScript to you. Don't panic. _This is the future_.

First of all, ES2015 (also known as ES6) is a set of improvements to JavaScript that is now part of the official standard, but not yet supported by all browsers, so often it isn't used yet in web development. React Native ships with ES2015 support, so you can use this stuff without worrying about compatibility. `import`, `from`, `class`, and `extends` in the example above are all ES2015 features. If you aren't familiar with ES2015, you can probably pick it up by reading through sample code like this tutorial has. If you want, [this page](https://babeljs.io/learn-es2015/) has a good overview of ES2015 features.
First of all, ES2015 (also known as ES6) is a set of improvements to JavaScript that is now part of the official standard, but not yet supported by all browsers, so often it isn't used yet in web development. React Native ships with ES2015 support, so you can use this stuff without worrying about compatibility. `import`, `export`, `const` and `from` in the example above are all ES2015 features. If you aren't familiar with ES2015, you can probably pick it up by reading through sample code like this tutorial has. If you want, [this page](https://babeljs.io/learn-es2015/) has a good overview of ES2015 features.

The other unusual thing in this code example is `<View><Text>Hello world!</Text></View>`. This is JSX - a syntax for embedding XML within JavaScript. Many frameworks use a specialized templating language which lets you embed code inside markup language. In React, this is reversed. JSX lets you write your markup language inside code. It looks like HTML on the web, except instead of web things like `<div>` or `<span>`, you use React components. In this case, `<Text>` is a [Core Component](intro-react-native-components) that displays some text and `View` is like the `<div>` or `<span>`.

Expand Down

0 comments on commit 3e30040

Please sign in to comment.