Reactjs 使用React Dnd touch后端示例
我是这个react dnd的新手,我想尝试在我的页面上实现这个touch后端,但它在这里尝试了这个示例,我的主要问题是在我的网页上尝试它,我需要索引是一个可导出的组件,而不是在dom上呈现,这部分:Reactjs 使用React Dnd touch后端示例,reactjs,drag-and-drop,Reactjs,Drag And Drop,我是这个react dnd的新手,我想尝试在我的页面上实现这个touch后端,但它在这里尝试了这个示例,我的主要问题是在我的网页上尝试它,我需要索引是一个可导出的组件,而不是在dom上呈现,这部分: var DragDropApp = DragDropContext(Touch({ enableMouseEvents: true }))(App); function render (lists = datasource) { ReactDOM.render(<DragDropAp
var DragDropApp = DragDropContext(Touch({ enableMouseEvents: true }))(App);
function render (lists = datasource) {
ReactDOM.render(<DragDropApp lists={lists} />, document.getElementById('main'));
}
render();
var DragDropApp=DragDropContext(Touch({enablemousevents:true}))(App);
函数呈现(列表=数据源){
ReactDOM.render(,document.getElementById('main'));
}
render();
我想要一些可以从父组件导出和调用的东西,我如何才能做到这一点?您可以这样做,例如:
export default DragDropApp;
然后在你的App.js
或任何地方:
render() {
return <DragDropApp lists={lists} />;
}
无法使其工作,我应该替换
函数render(lists=datasource){ReactDOM.render(,document.getElementById('main');}render()代码>用于导出默认DragDropApp代码>您应该只有:var DragDropApp=DragDropContext(Touch({enablemousevents:true}))(App)
然后是导出
。
ReactDOM.render(<App />, document.getElementById('main'));