Start a ReactJS project

Build react app using create-react-app

npm install -g create-react-app
create-react-app

npm start

Build react app from scratch

Start new project

npm init

npm install webpack webpack-cli --global

npm install react react-dom --save

npm install babel-loader babel-preset-env babel-preset-react

webpack init

Update babel setting: .babelrc

{
  "presets": [
    ["env", {
      "targets": {
        "chrome": "60",
        "node": "current"
      }
    }],
    ["react"]
  ]
}

Build and serve

webpack
# or
npm run build

npm install serve -g
serve -s build

你可能感兴趣的:(Start a ReactJS project)