gpt4 book ai didi

javascript - ReactJS:在多个列表之间拖放

转载 作者:行者123 更新时间:2023-11-30 15:56:26 24 4
gpt4 key购买 nike

我是 ReactJS 的新手。我有一个类似这样的组件:

<Section/>
<Lesson/>
<Lesson/>
<Lesson/>
<Section/>
<Lesson/>
<Lesson/>
<Section/>
<Lesson/>
<Lesson/>
<Lesson/>

如何在这些部分中拖放类(class)?我找到了图书馆帮助:https://github.com/bevacqua/react-dragula ,但我对 ref 部分 ReactDOM

有点困惑

最佳答案

我看了 Dragula 的例子。他们正在使用名为 ref Callback Attribute 的 React 功能.

来自文档:

React supports a special attribute that you can attach to any component. The ref attribute can be a callback function, and this callback will be executed immediately after the component is mounted. The referenced component will be passed in as a parameter, and the callback function may use the component immediately, or save the reference for future use (or both).

关于javascript - ReactJS:在多个列表之间拖放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38456426/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com