Giter Club home page Giter Club logo

redux-store's Introduction

Simple Redux Store

Vanilla TypeScript example of a Redux Store



This repo serves as the seed project for the Ultimate Angular NGRX Store + Effects course, as well as stepped solutions in separate branches, come and learn NGRX with us!

Prerequisites

  • Install Node.js

  • Install TypeScript

npm install -g typescript
  • Install Yarn (optional)

If you want to roll with npm, feel free to do so. If you'd like to try Yarn, run the following or another installation method:

npm install -g yarn

Setup

Installing dependencies

cd <redux-store-project>

yarn install
# OR
npm install

Local server

yarn start
# OR
npm start

Visit localhost:8000 in your browser.

redux-store's People

Contributors

toddmotto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

redux-store's Issues

Webpack Error

I got this error from Webpack:

screen shot 2018-06-18 at 11 45 33 pm

Seemed to be resolved by switching to ts-loader and updating which version of Webpack the project is using to 4.12.0:

webpack.config.js:

module.exports = {
  entry: './src/app.ts',
  output: {
    filename: 'app.js',
    path: __dirname + '/dist/',
  },
  devServer: {
    port: 8000,
  },
  resolve: {
    extensions: ['.ts', '.js'],
  },
  module: {
    rules: [
      {
        test: /\.ts$/,
        use: 'ts-loader',
      },
    ],
  },
};

package.json:

{
  "name": "store",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "start": "webpack-dev-server"
  },
  "devDependencies": {
    "awesome-typescript-loader": "3.2.3",
    "ts-loader": "^4.4.1",
    "typescript": "2.5.3",
    "webpack": "4.12.0",
    "webpack-cli": "^3.0.8",
    "webpack-dev-server": "3.1.4"
  }
}

Is there another way in which to resolve this issue? @toddmotto

Immutable state

First, I want to thank you very much. I learnt a lot!

I have a comment:
I think getting the value of the state like that still exposes it to mutation (because objects are assigned by reference)
https://github.com/UltimateAngular/redux-store/blob/9109ef8fd4b0639008975682fc4e7be33b275a1f/src/store/store.ts#L13

consider if I add this to button.addEventListener

    let state = store.value;
    state.todos = { mutated: true };
    console.log('Original state:::', store.value);
    console.log('Mutated state:::', state);

I think it is better to do this

  get value() {
    return { ...this.state };
  }

please correct me if I'm wrong. I'm still learning :)

thanks ๐Ÿ‘

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.