简体   繁体   中英

How do I setup React?

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 ?

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

You might also find these tutorials helpful as well:

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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM