コンテンツにスキップ

React Tutorial

https://github.com/watarukura/react-study https://ja.reactjs.org/tutorial/tutorial.html#setup-for-the-tutorial

  • yarn、初めて使った
    • yarn run って書くとrun可能なscriptのリストが出て便利
  • react/props-typesがどうしたこうしたみたいなエラーが出た

    Failed to compile.
    
    src/index.js
      Line 18:27:  'squares' is missing in props validation  react/prop-types
    
    Search for the keywords to learn more about each error.
    
    PropTypesで型定義を書いたらエラーが解消した
        https://ja.reactjs.org/docs/typechecking-with-proptypes.html
        yarn add prop-types した
    
    import PropTypes from "prop-types";
    
    Board.propTypes = {
      squares: PropTypes.object,
      onClick: PropTypes.func,
    };
    
    VS Code
        devContainer便利
            https://takeken1.hatenablog.com/entry/2021/01/02/221510
        シンプルブラウザーも便利
        prettierにformatもおまかせ
    
    https://gyazo.com/57c778fc9fa1f96699b446dc76c04fcf

  • わからん

    • JSXがそのままHTMLになるわけではないのね
      • という構文は、ビルド時に React.createElement('div') に変換されます。

      • Reactが隠蔽している挙動が全く想像できない
        • Vueでも同じ?
      • 続きはReactに書く
  • GitHub Actionsでlint