Skip to content

Latest commit

 

History

History
58 lines (43 loc) · 750 Bytes

README.md

File metadata and controls

58 lines (43 loc) · 750 Bytes

手撕react18.2源码

1.搭建开发环境

mkdir react-v18.2
cd react-v18.2
pnpm init -y

1.2 安装

新建.npmrc文件指定npmtaobao

registry=https://registry.npmmirror.com

安装vite和react的vite插件

npm install vite @vitejs/plugin-react --save-dev

1.3 启动

新建html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vite App</title>
  </head>

  <body>
    <div id="root"></div>
    <script type="module" src="/src/main.jsx"></script>
  </body>
</html>
{
  "scripts": {
    "dev": "vite"
  }
}

启动命令

npm run dev