Giter Site home page Giter Site logo

learningreactwithpiers's Introduction

安装脚手架初始化项目

  • npm install -g create-react-app 全局安装官方脚手架,mac上安装失败尝试sudo npm install -g create-react-app,然后输入电脑密码
  • create-react-app demo01 用脚手架创建React项目demo01
  • cd demo01 等创建完成后,进入项目目录
  • npm start 预览项目,如果能正常打开,说明项目创建成功

目录介绍

  • README.md :这个文件主要作用就是对项目的说明,已经默认写好了一些东西,你可以简单看看。如果是工作中,你可以把文件中的内容删除,自己来写这个文件,编写这个文件可以使用Markdown的语法来编写。
  • package.json: 这个文件是webpack配置和项目包管理文件,项目中依赖的第三方包(包的版本)和一些常用命令配置都在这个里边进行配置,当然脚手架已经为我们配置了一些了,目前位置,我们不需要改动。如果你对webpack了解,对这个一定也很熟悉。
  • package-lock.json:这个文件用一句话来解释,就是锁定安装时的版本号,并且需要上传到git,以保证其他人再npm install 时大家的依赖能保证一致。
  • gitignore : 这个是git的选择性上传的配置文件,比如一会要介绍的node_modules文件夹,就需要配置不上传。
  • node_modules :这个文件夹就是我们项目的依赖包,到目前位置,脚手架已经都给我们下载好了,你不需要单独安装什么。
  • public :公共文件,里边有公用模板和图标等一些东西。

public文件夹介绍

这个文件都是一些项目使用的公共文件,也就是说都是共用的
  • favicon.ico : 这个是网站或者说项目的图标,一般在浏览器标签页的左上角显示。
  • index.html : 首页的模板文件,我们可以试着改动一下,就能看到结果。
  • mainifest.json:移动端配置文件

src文件夹介绍

这个目录里边放的是我们开放的源代码,我们平时操作做最多的目录
  • index.js : 这个就是项目的入口文件
  • index.css :这个是index.js里的CSS文件。
  • app.js : 这个文件相当于一个方法模块,也是一个简单的模块化编程。
  • serviceWorker.js: 这个是用于写移动端开发的,PWA必须用到这个文件,有了这个文件,就相当于有了离线浏览的功能。

learningreactwithpiers's People

Contributors

pierszhang avatar

Stargazers

davy_chen avatar wendy avatar

Watchers

James Cloos 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.