相关疑难解决方法(0)

创建React App index.html和index.js连接

我开始玩Create React App,但我无法理解它index.js是如何加载的index.html.HTML代码是这样的:

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
    <!--
      Notice the use of %PUBLIC_URL% in the tag above.
      It will be replaced with the URL of the `public` folder during the build.
      Only files inside the `public` folder can be referenced from the HTML.

      Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
      work correctly both with client-side routing and a non-root public URL.
      Learn how to configure a …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs

47
推荐指数
1
解决办法
2万
查看次数

React 入口点:Index.html 与 index.js?节点代码在哪里?

我在互联网上的某个地方读到index.html了 React 应用程序的入口点。然而,同一篇文章接着说这index.js是主要入口点(以及大多数节点应用程序)。那么是哪一个呢?

当有人在浏览器中加载 React 应用程序时,我假设index.js首先运行,然后加载index.html. 但是这通常是如何发生的......就像在浏览器中加载应用程序到第一次运行的流程一样index.js

索引.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <meta
      name="description"
      content="Web site created using create-react-app"
    />
    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
    
    <title>React App</title>
  </head>
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

索引.js

import React from 'react';
import ReactDOM from …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs

3
推荐指数
2
解决办法
2560
查看次数

标签 统计

javascript ×2

reactjs ×2