【问题标题】:Why react.fragment and error is showing error while using div is working?为什么在使用 div 工作时 react.fragment 和 error 显示错误?
【发布时间】:2022-07-12 23:15:20
【问题描述】:
var Firstprog = require('react-dom');

Firstprog.render(
  <React.Fragment>
  <h1>Thapa Technical</h1>
  <p>Below is a list :</p>
  <ul>
    <li>netflix</li>
    <li>seires</li>
  </ul>
</React.Fragment>, document.getElementById("root"));

为什么 react.fragment 和 error 在使用 div 工作时显示错误? 错误 : 编译有问题:X

错误

[eslint] src\index.js 第 4:4 行:'React' 未定义 react/jsx-no-undef

搜索关键字以了解有关每个错误的更多信息。

【问题讨论】:

  • const React = require('react');

标签: javascript node.js reactjs


【解决方案1】:

您收到错误消息,因为您不需要React

const React = require('react');

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-03-31
    • 2021-08-08
    • 2019-01-05
    • 1970-01-01
    • 1970-01-01
    • 2022-06-10
    • 1970-01-01
    • 2021-01-21
    相关资源
    最近更新 更多