【问题标题】:I cannot figure it out <App /> meaning. it is hard to google我无法弄清楚 <App /> 的含义。谷歌很难
【发布时间】:2020-11-07 19:51:01
【问题描述】:
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
import "./index.css";
import "github-fork-ribbon-css/gh-fork-ribbon.css";

ReactDOM.render(<App />, document.getElementById("root"));

代码是这样的。在最后一行。我知道 ReactDom.render 是什么意思,但我不知道 是什么意思。尤其是“/>

【问题讨论】:

  • Google JSX,这可能是您缺少的术语
  • 可能有一个名为 App 的类扩展了 ./App 中的 React .component。

标签: javascript reactjs directory render


【解决方案1】:

App指的是第3行导入的文件:

import App from "./App";

在同一目录中打开App.js 以查看组件。如果您使用了create-react-app,它可能是您应用程序的根组件。

【讨论】:

  • 可以问一下中的“/>”吗?
  • HTML 结束标签。
  • 啊!。谢谢!现在我知道了。所以这根本不是那么重要。
猜你喜欢
  • 2015-08-03
  • 1970-01-01
  • 2012-11-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-03-26
  • 2011-09-15
相关资源
最近更新 更多