0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

React 入門 (#2) ~Babel&JSX~

Last updated at Posted at 2021-03-15

1,Babelとは

2021-03-14_14h24_31.png

ES6以降のスクリプトを、ES2015基準のスクリプトにトランスパイルする機能です。

下記のタグをheadタグに記述すれば準備完了です。

index.html
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>

Babelリンク

2,JSXを使う理由

Reactはマークアップとロジックを両方含む疎結合の「コンポーネント」という単位で構成されます。
コンポーネント」は、次回説明します。
そこで活躍するのが、JSX(「JavaScript XML」の略)です。
Reactのコンポーネント内で、マークアップ言語を記述するためのXML風の構文です。

3、ソースコードを記述

前回からの続きになります。
まず、index.htmlの準備です。
code6.png

index.jsに移動して記述します。
code7.png

**toUpperCase()**は、すべて大文字にするメソッドです。

4,ブラウザ表示

2021-03-14_21h51_55.png
リストが登場していますね。

次回は、

コンポーネントについて扱っていきます。
次回はここへ

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?