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 1 year has passed since last update.

Reactの学習記録②

Last updated at Posted at 2023-01-03

コンポーネント作成時の留意事項(親・子)

  • 子コンポーネントではexportを記述する
  • propsは親から子にデータを渡す
// 親
title = {'あいう'}
content = {'えお'}

// 子
{props.title} //あいう
{props.content} //えお

上記のように呼び出せる。

propsで受け渡せるデータ

  • propsのデータは{}に記述
  • 文字列、数値、真偽値、オブジェクト、日付などなんでもOK
  • 変数を渡すことも可能
  • 文字列は{}なしでもOK
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?