How do I setup React?

江枫思渺然 提交于 2019-12-10 22:16:07

问题


Please, I just want to start learning React, but I am not sure how to install it. Browserify was recommended but I have never used it before so I am confused.

After this command: npm install --save react react-dom babelify babel-preset-react, what do I do next? How do I create a folder and start using React? And what does this other command mean, browserify -t [ babelify --presets [ react ] ] main.js -o bundle.js?


回答1:


I'd recommend starting with the official tutorial instead of the getting started page.

You might also find these tutorials helpful as well:

  • Learning React & Concepts
  • Getting Started
  • Node.js and React



回答2:


Facebook actually put together a really useful tutorial for learning React. Don't worry too much about browserify and babel and the like. First focus on learning the fundamentals of React.




回答3:


I learned it by Henrik Joreteks Human Javascript Video-Tutorials. You can find them here. You will learn step-by-step ReactJS and everything that Comes along with it (npm, Backbone, webpack, babel, yeticss, ...) and it is real fun working along the tut.




回答4:


I just set this up myself on CentOS7, so, I thought I would share the knowledge.

--Install React:

sudo npm install -g create-react-app

--Assign the "Public" Zone to the Network Interface Used by React in Your Firewall:

firewall-cmd --zone=public --add-interface=eth0

--Open the Port for React in Your Firewall for Development Network:

firewall-cmd --zone=public --add-port=3000/tcp --permanent
firewall-cmd --zone=public --add-port=5000/tcp --permanent

Note: 3000 is development version, 5000 is production version.

--Create a React Project:

create-react-app project

--Enter Project Directory and Run NPM:

cd project
npm start

--You will get results like this:

Compiled successfully!

You can now view project in the browser.

    Local:            http://localhost:3000/
    On Your Network:  http://192.168.10.10:3000/

Then just load up that URL in a browser.

If you want to learn how to code in React now, then I recommend this tutorial: https://facebook.github.io/react/tutorial/tutorial.html



来源:https://stackoverflow.com/questions/34885370/how-do-i-setup-react

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!