Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 反应上下文未在CodeSandBox中运行_Reactjs_Codesandbox - Fatal编程技术网

Reactjs 反应上下文未在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,代码本身直接从中提取

我试图在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,代码本身直接从中提取。我已经查看了几次代码,但没有发现任何问题。这可能是我不理解的codesandbox的上下文设置吗?

您还必须使用16.3版本的
react dom
。在您的沙盒中,
react
是16.3.0,
react dom
是16.2.0。下面是一个沙箱,其中包含一个工作示例: