Reactjs 反应上下文未在CodeSandBox中运行
我试图在codesandbox中运行,但出现以下错误:Reactjs 反应上下文未在CodeSandBox中运行,reactjs,codesandbox,Reactjs,Codesandbox,我试图在codesandbox中运行,但出现以下错误: Invariant Violation Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of `MyProvider`. 我将React设置为16.3,代码本身直接从中提取
Invariant Violation
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of `MyProvider`.
我将React设置为16.3,代码本身直接从中提取。我已经查看了几次代码,但没有发现任何问题。这可能是我不理解的codesandbox的上下文设置吗?您还必须使用16.3版本的
react dom
。在您的沙盒中,react
是16.3.0,react dom
是16.2.0。下面是一个沙箱,其中包含一个工作示例: