Cannot read property 'replaceChild' of null

最近用react做百度一张图,但出现这种错误

VM4845 index.js:6481 Uncaught (in promise) TypeError: Cannot read property 'replaceChild' of null
    at Function.replaceChildWithTree (VM4845 index.js:6481)
    at Object.dangerouslyReplaceNodeWithMarkup (VM4845 index.js:45907)
    at Object.dangerouslyReplaceNodeWithMarkup [as replaceNodeWithMarkup] (VM4845 index.js:11462)
    at ReactCompositeComponentWrapper._replaceNodeWithMarkup (VM4845 index.js:50045)
    at ReactCompositeComponentWrapper._updateRenderedComponent (VM4845 index.js:50035)
    at ReactCompositeComponentWrapper._performComponentUpdate (VM4845 index.js:49985)
    at ReactCompositeComponentWrapper.updateComponent (VM4845 index.js:49906)
    at ReactCompositeComponentWrapper.performUpdateIfNecessary (VM4845 index.js:49822)
    at Object.performUpdateIfNecessary (VM4845 index.js:6394)
    at runBatchedUpdates (VM4845 index.js:2656)
    at ReactReconcileTransaction.perform (VM4845 index.js:8844)
    at ReactUpdatesFlushTransaction.perform (VM4845 index.js:8844)
    at ReactUpdatesFlushTransaction.perform (VM4845 index.js:2595)
    at Object.flushBatchedUpdates (VM4845 index.js:2678)
    at ReactDefaultBatchingStrategyTransaction.closeAll (VM4845 index.js:8910)
    at ReactDefaultBatchingStrategyTransaction.perform (VM4845 index.js:8857)
    at Object.batchedUpdates (VM4845 index.js:51179)
    at Object.enqueueUpdate (VM4845 index.js:2706)
    at enqueueUpdate (VM4845 index.js:12055)
    at Object.enqueueSetState (VM4845 index.js:12249)
    at DynamicComponent.ReactComponent.setState (VM4845 index.js:14866)
    at VM4845 index.js:54633

各种搜,各种检查,还是一直报错,后来在做另一个项目的时候发现,是因为在public中的index.html中引用了一个不存在的js文件。。。。

你可能感兴趣的:(react)