0.1.0 • Published 2 years ago

my-redux v0.1.0

Weekly downloads
2
License
-
Repository
-
Last release
2 years ago

My Redux

Build Status

This app demonstrates how you can build your own version of Redux. my-redux-example is an app which is using this package to maintain it's state. You can view the whole implementation in this file.

Example usage

Step 1: Import the createStore function from my-redux into your app

import createStore from "my-redux";

Step 2: Create a reducer function

const reducer = (state = initialState, action) =>
  action.type === "INCREMENT"
    ? { count: state.count + action.payload.count }
    : state;

Step 3: Pass that reducer function to the createStore function along with the initialState of your app

this.store = createStore(reducer, { count: 0 });

Step 4: Dispatch an action to update your store

this.store.dispatch({
  type: "INCREMENT",
  payload: {
    count: 1
  }
});

You store should now reflect the updated state. You can verify that by logging the state of your store:

console.log(this.store.getState());

my-redux-example is an app which is using this package to maintain it's state. You can view the whole implementation in this file.

Development

$ git clone https://github.com/ghoshnirmalya/my-redux
$ cd my-redux
$ yarn install

Running the tests

$ yarn test

Getting the test coverage

$ yarn coverage

Building the code

$ yarn build

Publish

$ yarn version patch|minor|major
$ yarn publish

It'll automatically run test, docs, build and generate CHANGELOG.md file.

License

MIT © Nirmalya Ghosh

0.1.0

2 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago