1

I am confused about React.js installation. I'am wondering what is better in development using React.js. The one that install using Node.js npm or the one that is using like this: <script src="build/react.js"></script> <script src="build/react-dom.js"></script> <script src="https://unpkg.com/[email protected]/browser.min.js"></script>

Can someone help me explain this because I really want to learn React.js.

When I try installing react using Node cmd I get this error and I dont know why?

2 Answers 2

3

If you are installing via npm , then you can use webpack , browserify to create the bundle js which would contain all your modules plus react one.

You can write your code in ES6 and webpack/babel can transpile that to Es5.

If you include the script as shown below

<script src="build/react.js"></script>
    <script src="build/react-dom.js"></script>
    <script src="https://unpkg.com/[email protected]/browser.min.js"></script>

Then as your modules/js files get loaded it will be transpiled which would be time consuming , because you are doing that operation in browser.

Go for the npm one, commonjs style is now common format

Sign up to request clarification or add additional context in comments.

1 Comment

I tried to make a project using npm but while i'm installing it on node cmd i get this error. See my edited post.
2

Your error could be the result of an anti-virus interfering with the npm install.
Look here: npm ERR! tarball.destroy is not a function

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.