LoginSignup
1

More than 3 years have passed since last update.

React_学習メモ_20190409

Last updated at Posted at 2019-04-09

今日も勉強したのでoutput!٩( 'ω' )و

現在勉強しているところ

React公式チュートリアルState のリフトアップ、再び

関数コンポーネント

reader()メソッドだけを有して自分のstateを持たないクラスは関数にできる。
(受け取った処理を返すだけなので、クラスを継承して状態を持つ必要がない。)

凡ミスリスト

- オブジェクト内にプロパティ列挙する場合はセミコロン;は使わない!

class Board extends React.Component {
  constructor(props){
    super(props);
    this.state ={
      squares: Array(9).fill(null),
      xIsNext: true;
    };
  }

6行目がセミコロンになってたので動かなんだ(´・ω・`)

わからないこと

class Game extends React.Component {
  constructor(props){
    super(props);
    this.state = {
      history: [{
        squares: Array(9).fill(null),
      }],
      xIsNext: true,
    };
  }

9行目のセミコロンが何故必要なのか?

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