0
0

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 1 year has passed since last update.

React 備忘録

Last updated at Posted at 2021-12-07

##使い方

  • インポート
  • クラス定義
  • メソッド定義(戻り値 jsx)
  • エクスポート
import React from 'react';
class App extends React.Component {
  render() {
  const text ="定数";
  return (
       {/*jsx*/}
    );
  }
}
export default App;

https://www.youtube.com/watch?v=gLbTluYSb_U&t=196s
##JSXとは

  • JavaScriptの拡張言
  • HTMLライクな記述
  • 拡張子.jsx / js

##階層構造で書く
###React.Fragment
HMTLタグとして出力されない

return(
  <React.Fragment>
   <p>React入門</p>
   <p>React入門</p>
  </React.Fragment>
)

###React.Fragmentの省略形

return(
  <>
   <p>React入門</p>
   <p>React入門</p>
  </>
)

###【エラー】非階層構造:Pタグの並列

return(
  {/*コメントはこう書く*/}
  <p>React入門</p>
  <p>React入門</p>
)
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?