ReactJs with create-react-app and Sublime Text
I came back to ReactJs after some time. It’s a lot easier now to start a new react app, and build the project after it’s finished, without any configuration. The npm package create-react-app makes the whole process a lot easier.
Preparing sublime for ReactJs development;
- Install babel-sublime Sublime Text package to have syntax highlighting for JSX (For other text editors, please follow steps at babeljs.io/docs/editors).
- Emmet works inside JSX by default if you expand emmet abbreviation by pressing ctrl+e, but if you have the habit of expanding emmet abbreviations using tab key, then add this snippet to your key bindings.
ReactJs installation (using create-react-app);
- Inside terminal execute
npm install -g create-react-app. It will install
create-react-appnpm package globally.
- Inside your projects folder execute
create-react-app app-name. A new react project will create with the name provided.
- cd to the project (e.g.,
npm startwhich will open your newly created bare-bone project at
localhost:3000in your default browser.
- Start editing
- When you want to build for production, execute
npm run buildinside the application’s folder.