-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from Atotti/Ritsu
chap04
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# React を始める | ||
プロジェクトでReactを使用するには、unpkg.com から二つのReactスクリプトをロードする必要あり。 | ||
- react | ||
- react-dom | ||
|
||
## JSXとは | ||
JavaScript の構文拡張機能で、HTML のような構文で UI を記述することができる。 | ||
しかし、そのままではブラウザはJSXを理解できないため、Babelなどのコンパイラツールを用いてJSXコードをJavaScriptに変換する。 | ||
|
||
### Babel | ||
JavaScriptにはECMAScriptというバージョンがあるため、上位・下位バージョンとの互換性が課題になってしまう。新しいバージョンの記法で描いたJavaScriptコードを下位バージョンのJavaScriptで動くようにする変換するツールが必要であり、これが「Babel」である。ちなみにこの変換のことをトランスパイルと呼ぶ。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<html> | ||
<body> | ||
<div id = "app"></div> | ||
<script src="https://unpkg.com/react@17/umd/react.development.js"></script> | ||
<script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script> | ||
<!-- Babel Script --> | ||
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script> | ||
<script type="text/jsx"> | ||
const app = document.getElementById('app'); | ||
ReactDOM.render(<h1>Develop. Preview. Ship. 🚀</h1>, app); | ||
</script> | ||
</body> | ||
</html> |