React Intro
react-intro
intro env
node: v12.13.1, npm: 6.12.1,
npx create-react-app my-app
install begins, this took 3min
react 16.12.0 installed
cd my-app npm start
pic
カッコいいのが開く
src/にindex.jsとindex.cssを作成
jsからcss読めるように
import React from 'react'; import ReactDOM from 'react-dom'; import './index.css';
を記入
jsとcssをcodepenからコピペ
続きを作っていくtutorial.
classの中にconstructor, super, this.state, を書いて実装する
defaultでpropsに値を渡されるからそれをconstructorに渡して stateに放り込んでいるのかな?
OXをcls BoardのconstructorではstateのxIsNextにTFでsave して,handleClick(i)の関数でthis.setStateで
xIsNext: !this.state.xIsNext,
として反転処理をする
renderでdivと{state}などを簡単に返せて便利