<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          react-cursorReact.js的不可變狀態(tài)

          聯(lián)合創(chuàng)作 · 2023-09-22 09:22

          react-cursor 是不變地處理遞歸或深度嵌套數(shù)據(jù)的工具。react-cursor是在ClojureScript中首次看到的抽象的javascript端口。此實(shí)現(xiàn)與任何渲染庫(kù)都沒(méi)有關(guān)聯(lián),并且非常小。

          示例代碼:

          var App = React.createClass({
              getInitialState: function () {
                  return {
                      "a": 10,
                      "b": {
                          "foo": {
                              "bar": 42,
                              "baz": ['red', 'green']
                          }
                      }
                  };
              },
              render: function () {
                  return <pre>{JSON.stringify(this.state, undefined, 2)}</pre>;
              }
          });
          
          var Cursor = require('path/to/react-cursor').Cursor;
          
          var cursor = Cursor.build(this) // `this` is the React component's this pointer
                                          // or the return value of React.renderComponent
          
                                          cursor.refine('a').value            //=> 10
          cursor.refine('a').onChange(11);
          cursor.refine('b').refine('foo').value      //=> { 'bar': 42, 'baz': ['red', 'green'] }
          cursor.refine('b').refine('foo').onChange({ 'bar': 43, 'baz': ['red', 'green'] })
          cursor.refine('b', 'foo', 'baz', 1).onChange('blue')
          瀏覽 12
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  久久国产福利视频 | 操骚逼的视频 | 手机看5689669AV | 成人视频在线观看黄色18 | 久久久91精品视频 |