Working with packages through package.json


#1

I’m super unfamiliar with anything beyond static
sites and playing with javascript in a sandbox. I’m using the facebook
tutorial to get my feet wet with react and JSX and the readme says “Just
add it to your package.json” what does that mean? I havent found any
documentation anywhere about how to work with package.json.

How do I get it to render? Do I add all of the files from the starter
pack to my HyperDev VM? Do I just type in some voodoo to package.json?


#2

“Add React to your package.json” means to include it in the dependencies list in package.json. This Part:

    "dependencies": {
    "express": "^4.12.4"
    }

The latest version of React on NPM is 15.1.0, to install it you can change that bit to

    "dependencies": {
    "express": "^4.12.4",
    "react": "^15.1.0"
    }

On hyperdev when you change something in package.json the app will install any new dependencies (open up the logs while you do it to see.)

So you should now have react installed and available to use. (It’s inside node_nodules/ which hyperdev doesnt show.)

If you were to download your project to try locally you would use npm install from the projects directory to create the node_modules/ directory and install the dependencies there.

As for how to use React from there, sorry I have no idea :disappointed_relieved:
I’m sure there are plenty of guides around for it though.
Maybe I should finally get around to reading some.


#3

I provided a response to this question in the other thread where you asked it: http://support.hyperdev.com/t/react-with-jsx-on-hyperdev/149/10?u=gareth