-
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 #23 from Atotti/kotsugi
Kotsugi
- Loading branch information
Showing
3 changed files
with
346 additions
and
2 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
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
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,24 @@ | ||
# コンポーネントを使ったUIの作成 | ||
## コンポーネント | ||
- 機能やUIを再利用可能な単位でまとめたもの | ||
- ReactにおけるUIの基本的な構成要素 | ||
- Chapter03のようなUIの作成方法では,機能に切り出しての再利用が難しい | ||
|
||
## 関数コンポーネント | ||
- ReactではコンポーネントをJSXを戻り値にとる関数としている | ||
```js | ||
function Header() { | ||
return <h1>Hello, World</h1>; | ||
} | ||
|
||
function Homepage() { | ||
return ( | ||
<div> | ||
<Header/> | ||
</div> | ||
) | ||
} | ||
|
||
ReactDOM.render(<HomePage/>, app); | ||
``` | ||
- 上記のコードでは,`Header()`と`Homepage()`がコンポーネントである |