setting up react from scratch code example

Example 1: how to create a react app from scratch

// In npx -> 
npx create-react-app my-app

// In npm -> 
npm init react-app my-app

// In yarn -->
yarn create react-app my-app

Example 2: reactjs and webpack tutorial

npm i webpack webpack-cli --save-dev

Example 3: add webpack to react project

module.exports = {  entry: './src/index.js',  module: {    rules: [      {        test: /\.(js|jsx)$/,        exclude: /node_modules/,        use: ['babel-loader']      }    ]  },  resolve: {    extensions: ['*', '.js', '.jsx']  },  output: {    path: __dirname + '/dist',    publicPath: '/',    filename: 'bundle.js'  },  devServer: {    contentBase: './dist'  }};