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/babel-core@5.8.38/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?

Undecided Dev
  • 840
  • 6
  • 16

2 Answers2

2

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/babel-core@5.8.38/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

Piyush.kapoor
  • 6,715
  • 1
  • 21
  • 21
1

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

Community
  • 1
  • 1
Mike Hanslo
  • 274
  • 3
  • 14