how to run a react app locally code example

Example 1: npm create react app

npx create-react-app app-name
cd app-name
npm start

Example 2: npm start react

npx create-react-app mon-app
cd mon-app
npm start

Example 3: how to create react app using yarn

yarn create react-app my-app

Example 4: Create React App command

npx create-react-app hello-world
cd hello-world && npm start

Example 5: create-react-app npm yarn

to override yarn
npx create-react-app my-app --use-npm

Example 6: setup the react on local machine

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
   entry: './main.js',
   output: {
      path: path.join(__dirname, '/bundle'),
      filename: 'index_bundle.js'
   },
   devServer: {
      inline: true,
      port: 8001
   },
   module: {
      rules: [
         {
            test: /\.jsx?$/,
            exclude: /node_modules/,
            loader: 'babel-loader',
            query: {
               presets: ['es2015', 'react']
            }
         }
      ]
   },
   plugins:[
      new HtmlWebpackPlugin({
         template: './index.html'
      })
   ]
}