reactDOM' 未定义 no-undef

时间:2021-03-20 08:12:52

标签: reactjs jsx

我的 index.js 文件中出现错误:

Failed to compile src\index.js
Line 5:1: 'reactDOM' is not defined no-undef

搜索关键字以了解有关每个错误的更多信息。 此错误发生在构建期间,无法消除。

我在 index.js 中的代码是:

import React from "react";
import ReactDOM from "react-dom";

const element = <h1>Hello, World!</h1>
reactDOM.render(element, document.getElementById("root"))

我在 Windows 机器上。

请尽可能快速准确地帮助我。

1 个答案:

答案 0 :(得分:0)

它应该是 ReactDOM 而不是 reactDOM(在 ReactDOM.render 中)。