如何跟踪:必须返回有效的React元素(或null)

时间:2018-10-21 19:02:50

标签: reactjs

我收到此错误,并且我对代码进行了三重检查,看不到任何可能发生的情况。可悲的是,React在倾销这些方面并没有提供真正好的开发者经验:

modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:14378 Uncaught (in promise) Error: Error(...): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.
    at invariant (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:14378)
    at ReactCompositeComponentWrapper.mountComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:28185)
    at Object.mountComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:21103)
    at Object.obj.(anonymous function) [as mountComponent] (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/backend.js:8847:20)
    at Object.updateChildren (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:27816)
    at ReactDOMComponent._reconcilerUpdateChildren (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:27344)
    at ReactDOMComponent._updateChildren (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:27448)
    at ReactDOMComponent.updateChildren (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:27435)
    at ReactDOMComponent._updateDOMChildren (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:24843)
    at ReactDOMComponent.updateComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:24657)
    at ReactDOMComponent.receiveComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:24619)
    at Object.receiveComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:21182)
    at Object.obj.(anonymous function) [as receiveComponent] (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/backend.js:8847:20)
    at ReactCompositeComponentWrapper._updateRenderedComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:28744)
    at ReactCompositeComponentWrapper._performComponentUpdate (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:28714)
    at ReactCompositeComponentWrapper.updateComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:28635)
    at ReactCompositeComponentWrapper.receiveComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:28537)
    at Object.receiveComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:21182)
    at Object.obj.(anonymous function) [as receiveComponent] (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/backend.js:8847:20)
    at Object.updateChildren (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:27804)
    at ReactDOMComponent._reconcilerUpdateChildren (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:27344)
    at ReactDOMComponent._updateChildren (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:27448)
    at ReactDOMComponent.updateChildren (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:27435)
    at ReactDOMComponent._updateDOMChildren (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:24843)
    at ReactDOMComponent.updateComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:24657)
    at ReactDOMComponent.receiveComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:24619)
    at Object.receiveComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:21182)
    at Object.obj.(anonymous function) [as receiveComponent] (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/backend.js:8847:20)
    at Object.updateChildren (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:27804)
    at ReactDOMComponent._reconcilerUpdateChildren (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:27344)
    at ReactDOMComponent._updateChildren (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:27448)
    at ReactDOMComponent.updateChildren (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:27435)
    at ReactDOMComponent._updateDOMChildren (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:24843)
    at ReactDOMComponent.updateComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:24657)
    at ReactDOMComponent.receiveComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:24619)
    at Object.receiveComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:21182)
    at Object.obj.(anonymous function) [as receiveComponent] (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/backend.js:8847:20)
    at ReactCompositeComponentWrapper._updateRenderedComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:28744)
    at ReactCompositeComponentWrapper._performComponentUpdate (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:28714)
    at ReactCompositeComponentWrapper.updateComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:28635)
    at ReactCompositeComponentWrapper.receiveComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:28537)
    at Object.receiveComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:21182)
    at Object.obj.(anonymous function) [as receiveComponent] (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/backend.js:8847:20)
    at ReactCompositeComponentWrapper._updateRenderedComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:28744)
    at ReactCompositeComponentWrapper._performComponentUpdate (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:28714)
    at ReactCompositeComponentWrapper.updateComponent (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:28635)
    at ReactCompositeComponentWrapper.performUpdateIfNecessary (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:28551)
    at Object.performUpdateIfNecessary (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:21214)
    at Object.obj.(anonymous function) [as performUpdateIfNecessary] (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/backend.js:8847:20)
    at runBatchedUpdates (modules.js?hash=389cfb2ce1d70595de1822b880ef69787f9d796d:20795)

该如何追踪?它没有告诉我哪个组件引起了麻烦。

0 个答案:

没有答案