如何建立 React 專案 ?

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

内容简介: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 專案 ?》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

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

The Elements of Statistical Learning

The Elements of Statistical Learning

Trevor Hastie、Robert Tibshirani、Jerome Friedman / Springer / 2009-10-1 / GBP 62.99

During the past decade there has been an explosion in computation and information technology. With it have come vast amounts of data in a variety of fields such as medicine, biology, finance, and mark......一起来看看 《The Elements of Statistical Learning》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试