Giter Club home page Giter Club logo

boilmaker-react-redux-webpack's Introduction

Set up Project

  • npm run build: bundle js file into bundle.js each time when you change .js file
  • npm run watch : auto keep update bundle result after each modify of .js file.

React

  1. construct an index.html, have

    • bundle.js script
    • root element where to render React component
  2. Dependencies

    npm i react react-dom react-router-dom
  3. construct an index.js, to render React DOM

Redux

  1. install dependencies

    npm i @reduxjs/toolkit react-redux
  2. store folder store all files about redux

    • index.js : define store
    • slices folder: includes all definition of slice
  3. Connect redux to react app in index.js (root)

Webpack

  1. install dev dependencies

    npm i -D webpack webpack-cli @babel/core  @babel/preset-env @babel/preset-react babel-loader
    css-loader style-loader
  2. create webpack.config.js in root directory

    • entry: the entry point of index.js
    • output: where to output the bundle result
    • add rule to load js file, css file
    module.exports = {
      mode: "development",
      entry: ["./index.js"],
      output: {
        path: __dirname,
        filename: "./public/dist/bundle.js",
      },
      devtool: "source-map",
      module: {
        rules: [
          {
            test: /\.jsx?$/,
            exclude: /node_modules/,
            loader: "babel-loader",
            options: {
              presets: ["@babel/preset-env", "@babel/preset-react"],
            },
          },
          {
            test: /\.css$/,
            use: ["style-loader", "css-loader"],
          },
        ],
      },
    };

ESLint

  • create .eslintrc.json at root directory
  • add extent to ignore component unused warning
{ "extends": "react-app" }

boilmaker-react-redux-webpack's People

Contributors

na-lin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.