【问题标题】:react-sortable-tree Crud Operation using hooks使用钩子的 react-sortable-tree Crud 操作
【发布时间】:2021-01-08 11:25:32
【问题描述】:

我会尝试做一个 react-sortable-tree Crud 操作。编辑后我很难更新数据。请任何人澄清我的问题。我会在下面附上我的代码沙箱实时链接。

https://codesandbox.io/s/zealous-browser-06fqg?file=/src/App.js

【问题讨论】:

    标签: javascript html css reactjs fluent-ui


    【解决方案1】:
      //Update node
      const updateNode = (rowInfo, data) => {
        // console.log(data, "data")
        console.log(numbers, "array position");
        console.log(path, "path position");
        console.log(rowInfo, "rowInfo value");
        var treeIndex = numbers;
        var paths = path;
        console.log(treeIndex, "treeIndex position");
        if (action === "edit") {
          treeData[treeIndex].title = rowInfo;
          settreeData([...treeData]);
          setaction("add");
        } else {
          settreeData([...treeData, { title: rowInfo }]);
          alert("hello");
          setaction("add");
        }
      };
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-05
      • 1970-01-01
      • 1970-01-01
      • 2019-06-24
      • 1970-01-01
      • 2015-06-01
      • 1970-01-01
      相关资源
      最近更新 更多