Getting Started with React and Webpack
__EDIT__: I missed Create React App from Facebook .. Strongly recommend that instead of the following :-)
While using React and Webpack at work has taught me a lot, what it hasn’t taught me, is how to start a new project with it. Here is my contribution to the web about how to start a new project with React.
Assumption is you have Node and NPM installed, if not install it here.
Install the following dependencies:
Navigate to a new directory and run:
yo react-webpack. It will ask you some questions:
- Please choose your application name:
- Which style language do you want to use?
SCSSnote: this is a personal preference, choose what you’re comfortable with.
- Enable postcss?
npm start and once it’s finished loading you should be able to hit
http://localhost:8000. The generator we used has Hot Reload installed which means if you edit files from within your project, the development server will re-build the assets and reload the assets within your page without having to reload the browser.
Although short and relatively easy, this documentation wasn’t readily available that I could find, so I hope this helps someone else :)