Giter Site home page Giter Site logo

react_demo's Introduction

从头开始实现一个react单页面开发

1.首先在命令行工具里面进入到该项目目录下,然后添加package.json文件,执行命令:npm init,可自行添加一些信息,一路回车即可。

2.创建webpack.config.js文件

3.下载react相关依赖 npm i react react-dom react-router-dom -S

4.下载webpack,npm i webpack -D ,同时需要全局安装webpack,方便命令行打包使用,执行npm i -g webpack

5.在项目中新建文件夹src,mkdir src,在src下面新建一个App.js文件

6.在webpack.config.js中写入配置,并且安装webpackhtmlplugin和babel-loader,执行 npm i html-webpack-plugin babel-loader @babel/core @babel/preset-env @babel/preset-react -D

7.往App.js里面写入一些内容,并且添加一个index.html文件,就可以执行打包了,通常会提示需要安装webpack-cli,那就安装呗,安装之后,再次执行webpack,就可以看到打包成功啦

react_demo's People

Contributors

dcwang316 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.