1
2

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 5 years have passed since last update.

JSX記法

1
Posted at

JSX記法メモ

index.js
ReactDOM.render(
  <div>Hello World</div>, // 末尾のカンマがないと動かない
  document.getElementById('root')
);

classの付け方

index.js
ReactDOM.render(
  <div className="hello">Hello World</div>, // classは予約語なのでclassNameを使う
  document.getElementById('root')
);

イベントの付け方

index.js
ReactDOM.render(
  <div onClick={関数名}>Hello World</div>, // 関数名を波括弧で囲う
  document.getElementById('root')
);
1
2
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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?