zoukankan      html  css  js  c++  java
  • react初接触

    第一步:安装node
    第二部:npm init

    D:ceshidome>npm init
    This utility will walk you through creating a package.json file.
    It only covers the most common items, and tries to guess sensible defaults.

    See npm help json for definitive documentation on these fields
    and exactly what they do.

    Use npm install <pkg> afterwards to install a package and
    save it as a dependency in the package.json file.

    Press ^C at any time to quit.
    package name: (dome) dome
    version: (1.0.0)
    description:
    entry point: (index.js) index.js
    test command:
    git repository:
    keywords:
    author:
    license: (ISC)
    About to write to D:ceshidomepackage.json:

    {
    "name": "dome",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
    "test": "echo "Error: no test specified" && exit 1"
    },
    "author": "",
    "license": "ISC"
    }

    Is this OK? (yes) y

    第三步:npm install --save react react-dom

    npm notice created a lockfile as package-lock.json. You should commit this file.
    npm WARN dome@1.0.0 No description
    npm WARN dome@1.0.0 No repository field.

    • react@16.8.6
    • react-dom@16.8.6
      added 8 packages from 3 contributors and audited 26 packages in 3.243s
      found 0 vulnerabilities

    第四步:npm install --save-dev @babel/preset-react
    第五步:npm install -g webpack
    第六步:npm install -g webpack-dev-server
    第七步:npm install webpack-dev-server --save
    第八步:npm install webpack --save
    第九步:webpack
    报错:
    Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
    因为版本改了,新版本初始化时不一样,需要换版本
    第十步:webpack --watch 监听代码,代码发生改变时页面也自动改变
    第十一步:webpack-dev-server 热加载或者 webpack-dev-server --contentbase src
    第十二步:webpack-dev-server --contentbase src --inline --hot 指定打开的页面地址栏地址并热加载

  • 相关阅读:
    Screen print or copy
    <转>关于SQL Server数据库的若干注意事项
    sql server 链接到oracle库,读取对应信息
    LinkedServer链接服务器的使用
    序号生成一例
    新解:报表服务器数据库的版本格式无效,或无法读取。已找到的版本为“Unknown”,而所需的版本为“C.0.8.40”。
    GridView to Excel
    sql server临时表是否存在
    <转>SQL Server大表转为分区表实例
    <转> 人生十二个经典领悟
  • 原文地址:https://www.cnblogs.com/rswl/p/10683568.html
Copyright © 2011-2022 走看看