zan-design出现react dnd报错

报错信息:
Warning:ComponentEditorCarddeclared`PropTypes`insteadof`propTypes`.Didyoumisspellthepropertyassignment?
Warning:Failedcontexttype:Thecontext`dragDropManager`ismarkedasrequiredin`DropTarget(DragSource(EditorCardItem))`,butitsvalueis`undefined`.
inDropTarget(DragSource(EditorCardItem))(createdbyEditorCard)
indiv(createdbyEditorCard)
inEditorCard(createdbyShowCaseEditor)
indiv(createdbyShowCaseEditor)
inShowCaseEditor(createdbyDroppable)
indiv(createdbyDesignEditorItem)
inDesignEditorItem(createdbyDroppable)
indiv(createdbyDesignPreviewItem)
inDesignPreviewItem(createdbyDroppable)
indiv(createdbyDroppable)
inDroppableDimensionPublisher(createdbyConnect(DroppableDimensionPublisher))
inConnect(DroppableDimensionPublisher)(createdbyDroppable)
inDroppable(createdbyConnect(Droppable))
inConnect(Droppable)(createdbyDesignPreview)
indiv(createdbyDesignPreview)
inDragDropContext(createdbyDesignPreview)
inDesignPreview(createdbyDesign)
indiv(createdbyDesign)
inDesign(atindex.js:141)
indiv(atindex.js:139)
inCreate(createdbyRoute)
inRoute(createdbywithRouter(Create))
inwithRouter(Create)(createdbyRoute)
inRoute(atroutes.js:21)
inSwitch(atroutes.js:20)
inRouter(createdbyBrowserRouter)
inBrowserRouter(atroutes.js:19)
inRoutes(atindex.js:13)
UncaughtError:CouldnotfindthedraganddropmanagerinthecontextofDragSource(EditorCardItem).Makesuretowrapthetop-levelcomponentofyourappwithDragDropContext.Readmore:http://react-dnd.github.io/react-dnd/docs-troubleshooting.html#could-not-find-the-drag-and-drop-manager-in-the-context
atinvariant(browser.js:38)
atnewDragDropContainer(decorateHandler.js:102)
atconstructClassInstance(react-dom.development.js:6355)
atupdateClassComponent(react-dom.development.js:7839)
atbeginWork(react-dom.development.js:8225)
atperformUnitOfWork(react-dom.development.js:10224)
atworkLoop(react-dom.development.js:10288)
atHTMLUnknownElement.callCallback(react-dom.development.js:542)
atObject.invokeGuardedCallbackDev(react-dom.development.js:581)
atinvokeGuardedCallback(react-dom.development.js:438)
atrenderRoot(react-dom.development.js:10366)
atperformWorkOnRoot(react-dom.development.js:11014)
atperformWork(react-dom.development.js:10967)
atrequestWork(react-dom.development.js:10878)
atscheduleWorkImpl(react-dom.development.js:10732)
atscheduleWork(react-dom.development.js:10689)
atObject.enqueueSetState(react-dom.development.js:6212)
atDesign../node_modules/react/cjs/react.development.js.Component.setState(react.development.js:237)
atDesign.onSelect(Design.js:773)
atonAdd(Design.js:817)
atDesignEditorAddComponent.js:100
Theaboveerroroccurredinthecomponent:
inDropTarget(DragSource(EditorCardItem))(createdbyEditorCard)
indiv(createdbyEditorCard)
inEditorCard(createdbyShowCaseEditor)
indiv(createdbyShowCaseEditor)
inShowCaseEditor(createdbyDroppable)
indiv(createdbyDesignEditorItem)
inDesignEditorItem(createdbyDroppable)
indiv(createdbyDesignPreviewItem)
inDesignPreviewItem(createdbyDroppable)
indiv(createdbyDroppable)
inDroppableDimensionPublisher(createdbyConnect(DroppableDimensionPublisher))
inConnect(DroppableDimensionPublisher)(createdbyDroppable)
inDroppable(createdbyConnect(Droppable))
inConnect(Droppable)(createdbyDesignPreview)
indiv(createdbyDesignPreview)
inDragDropContext(createdbyDesignPreview)
inDesignPreview(createdbyDesign)
indiv(createdbyDesign)
inDesign(atindex.js:141)
indiv(atindex.js:139)
inCreate(createdbyRoute)
inRoute(createdbywithRouter(Create))
inwithRouter(Create)(createdbyRoute)
inRoute(atroutes.js:21)
inSwitch(atroutes.js:20)
inRouter(createdbyBrowserRouter)
inBrowserRouter(atroutes.js:19)
inRoutes(atindex.js:13)
Consideraddinganerrorboundarytoyourtreetocustomizeerrorhandlingbehavior.
Visithttps://fb.me/react-error-boundariestolearnmoreabouterrorboundaries.
Warning:Canonlyupdateamountedormountingcomponent.ThisusuallymeansyoucalledsetState,replaceState,orforceUpdateonanunmountedcomponent.Thisisano-op.
PleasecheckthecodefortheDesigncomponent.
问题出现:
https://github.com/youzan/zen...跑起来没有问题的
使用creaet-react-app创建项目并引入zan-design引入魔方和橱窗组件点击时候会出现以上问题导致页面无法显示
使用create-react-app新建项目并提取demo的client文件夹部分跑起项目,同样出现以上问题。
如果由于reactdnd找不到context问题为何官网demo没有暴露?
慕哥9229398
浏览 1155回答 2
2回答

FFIVE

ReactDnd需要一层包裹,需要你自己包一下,可以参考以下代码importHTML5Backendfrom'react-dnd-html5-backend';import{DragDropContext}from'react-dnd';classYourApp{/.../}exportdefaultDragDropContext(HTML5Backend)(YourApp);
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript