如何建立 React 專案 ?

栏目: IOS · Android · 发布时间: 5年前

内容简介:React 16.8 的 Hooks 橫空出世後,其 Functional Component 也能有 state 的寫法讓大家大為驚豔,React 從此也可以完全不寫 class,使用更 FP 方式實現。Node.js 8.12.0Create-react-app 2.1.3

React 16.8 的 Hooks 橫空出世後,其 Functional Component 也能有 state 的寫法讓大家大為驚豔,React 從此也可以完全不寫 class,使用更 FP 方式實現。

Version

Node.js 8.12.0

Create-react-app 2.1.3

React 16.8.1

安裝 Node.js

(略)

安裝 Yarn

(略)

安裝 Create-react-app 套件

$ yarn global add create-react-app

React 建置工具,用來建立 React 專案,相當於 Angular CLI、Vue CLI 地位。

如何建立 React 專案 ?

建立 React 專案

$ npx create-react-app react-hello-world

使用 npx create-react-app 建立 React 專案。

如何建立 React 專案 ?

如何建立 React 專案 ?

  1. 建立成功後,最後會提示你進入專案目錄後,輸入 yarn start 啟動內建 Web Server。

啟動 Web Server

$ cd react-hello-world
react-hello-world $ yarn serve

如何建立 React 專案 ?

  1. React 啟動在 http://localhost:3000

如何建立 React 專案 ?

Conclusion

  • Create-react-app 讓 React 的學習門檻降低了,Webpack 之類的設定都會由 create-react-app 幫我們搞定

以上所述就是小编给大家介绍的《如何建立 React 專案 ?》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Building Websites with Joomla!

Building Websites with Joomla!

H Graf / Packt Publishing / 2006-01-20 / USD 44.99

This book is a fast paced tutorial to creating a website using Joomla!. If you've never used Joomla!, or even any web content management system before, then this book will walk you through each step i......一起来看看 《Building Websites with Joomla!》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具