.NET 開発基盤部会 Wiki」は、「Open棟梁Project」,「OSSコンソーシアム .NET開発基盤部会」によって運営されています。

目次

概要

手順1

https://github.com/OpenTouryoProject/FrontendTemplates/tree/develop/SPA/React/react_template

をベースにしてASP.NETのCRUD処理を実装する。

ポイント

Styleの指定方法

以下があるが、基本は1、2辺りを使う。

  1. Classによるスタイリング
    JSXではclassが予約語となっているためclassName 属性を使用する。
     
  2. インラインのスタイリング
    • 例1
      return (
        <button className="btn btn-default" style={{color: "red"}}/>
      );
    • 例2
      var btnstyle = {
        color: "red"
      };
      return (
        <button className="btn btn-default" style={btnstyle}/>
      );
  3. CSS Modules
  4. CSS in JS

Controlled Component on Form

Each child in an array should have a unique "key" prop.

mapでループする場合、JSXのelementにkeyプロパティを追加する。

fetch APIでPOST or JOSN-RPC

以下のように処理できる。

fetch("URL", {method, headers, body}).then(...

参考

Styleの指定方法

Controlled Component on Form

Each child in an array should have a unique "key" prop.

fetch APIでPOST or JOSN-RPC

手順2

https://github.com/OpenTouryoProject/FrontendTemplates/tree/develop/SPA/React/redux_template

をベースにしてASP.NETのCRUD処理を実装する。

振返り

そもそもReduxってなんだっけ?

ポイント

stateのprop化

Componentのstateを、Container側でmapStateToProps?することでprop化する。

イベントのActions

合わせて、ReducersStoreを実装

TextBox?の双方向バインド

双方向バインドを行う場合、input type="text" の onChange時をRedux化する必要がある。

手順3

手順4

参考

Reactのファースト・ステップ

Reactのセカンド・ステップ


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS