今日も勉強したので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行目のセミコロンが何故必要なのか?