小编Gui*_*uel的帖子

React,webpack-dev-server - 错误:_registerComponent(...):目标容器不是 DOM 元素

我正在使用 webpack-dev-server 来开发一个更大的项目,到目前为止,除了与 React Developer Tools 的连接之外,一切正常。

在过去的几天里,我阅读了很多关于这个问题的帖子,并发现 webpack-dev-server 使用了一个 iframe,而 React Developer Tool 不支持它(目前)。

由于我无法使用 webpack-dev-server 和 React Developer Tools,我尝试直接运行 index.html。index.html 现在抛出以下错误:

错误:_registerComponent(...):目标容器不是 DOM 元素。bundle.js:1115:16

索引.html

<!doctype html>
<html>

<head>
    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>MetVis</title>
    <link rel="stylesheet" href="css/main.css" />
    <link rel="stylesheet" href="css/bootstrap.min.css">
</head>

<body>
    <div id="container"></div>
    <script src="bundle.js"></script>
</body>
Run Code Online (Sandbox Code Playgroud)

应用程序.jsx

const router = (
    <Router history={hashHistory}>
        <Route path="/" component={App}>
            <IndexRoute component={Main} />
            <Route path="/index" component={Index} />
            <Route path="/location" component={Main} />
            <Route path="/comparison" component={Comparison} />
            <Route path="/sensors" component={Sensors} …
Run Code Online (Sandbox Code Playgroud)

javascript jsx reactjs webpack

5
推荐指数
0
解决办法
295
查看次数

标签 统计

javascript ×1

jsx ×1

reactjs ×1

webpack ×1