0.4.65 • Published 1 year ago

@github1/redux-modules v0.4.65

Weekly downloads
136
License
-
Repository
-
Last release
1 year ago

@github1/redux-modules

An implementation of the redux modules pattern to modularize redux reducers, middleware and action creators

This package provides a class, called Module, which encapsulates redux elements such as reducer, middleware, actions, preloadedState in a cohesive structure which makes it easier to build, configure and reuse logic in a redux store.

build status npm version npm downloads

Install

npm install @github1/redux-modules --save-dev

Usage

import { Module } from '@github1/redux-modules';

const store = Module.create({
  name: 'myModule',
  preloadedState: {
    count: 0
  },
  reducer: (state = {}, action) => {
    if ('INCREMENT' === action.type) {
        return {
          ...state,
          count: state.count + 1
        };
    }
    return state;
  }
}).inStore();
store.dispatch({ type: 'INCREMENT' });

Examples

See @github1/react-redux-common-modules for actual modules written with this package.

Define a module from middleware

const module = Module.fromMiddleware(() => next => action => {
                          // behavior
                          next(action);
                      });

Define preloaded/initial state

const module = Module.create({
  name: 'myModule',
  preloadedState: {
    something: 12345
  }
});

Dispatch actions when the module is registered

const module = Module.create({
  postConfigure: store => {
    store.dispatch({ ... });
  }
});

Enforce immutable state

const immutableModule = Module.create({...}).enforceImmutableState();

Create a redux store with multiple modules

const store = Module.createStore(module1, module2);

License

MIT

0.4.64

1 year ago

0.4.65

1 year ago

0.4.62

1 year ago

0.4.63

1 year ago

0.4.60

1 year ago

0.4.61

1 year ago

0.4.59

1 year ago

0.4.58

1 year ago

0.4.48

2 years ago

0.4.49

2 years ago

0.4.53

2 years ago

0.4.54

2 years ago

0.4.51

2 years ago

0.4.52

2 years ago

0.4.50

2 years ago

0.4.57

2 years ago

0.4.55

2 years ago

0.4.56

2 years ago

0.4.46

2 years ago

0.4.47

2 years ago

0.4.45

2 years ago

0.4.44

3 years ago

0.4.43

3 years ago

0.4.42

3 years ago

0.4.40

3 years ago

0.4.41

3 years ago

0.4.39-next.1

3 years ago

0.4.39-next.0

3 years ago

0.4.39

3 years ago

0.4.37

3 years ago

0.4.38

3 years ago

0.4.36

3 years ago

0.4.35

3 years ago

0.4.32

3 years ago

0.4.33

3 years ago

0.4.34

3 years ago

0.4.31

3 years ago

0.4.30

3 years ago

0.4.29

3 years ago

0.4.20

3 years ago

0.4.21

3 years ago

0.4.28

3 years ago

0.4.26

3 years ago

0.4.27

3 years ago

0.4.24

3 years ago

0.4.25

3 years ago

0.4.22

3 years ago

0.4.23

3 years ago

0.4.19

3 years ago

0.4.18

3 years ago

0.4.17

3 years ago

0.4.15

3 years ago

0.4.16

3 years ago

0.4.14

3 years ago

0.4.14-next.0

3 years ago

0.4.13

3 years ago

0.4.12

3 years ago

0.4.13-next.0

3 years ago

0.4.13-next.1

3 years ago

0.4.9

3 years ago

0.4.10

3 years ago

0.4.11

3 years ago

0.4.8

3 years ago

0.4.7

3 years ago

0.4.6

3 years ago

0.4.5-next.0

3 years ago

0.4.5

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.106-next.0

4 years ago

0.3.105

5 years ago

0.3.106

5 years ago

0.3.103

5 years ago

0.3.104

5 years ago

0.3.102

5 years ago

0.3.101

5 years ago

0.3.100

5 years ago

0.3.98

5 years ago

0.3.97

5 years ago

0.3.96

5 years ago

0.3.95

5 years ago

0.3.94

5 years ago

0.3.93

5 years ago

0.3.92

5 years ago

0.3.91

5 years ago

0.3.90

5 years ago

0.3.89

5 years ago

0.3.88

5 years ago

0.3.87

5 years ago

0.3.86

5 years ago

0.3.85

5 years ago

0.3.84

5 years ago

0.3.83

5 years ago

0.3.82

5 years ago

0.3.81

5 years ago

0.3.80

5 years ago

0.3.79

5 years ago

0.3.78

5 years ago

0.3.77

5 years ago

0.3.75

5 years ago

0.3.74

5 years ago

0.3.76

5 years ago

0.3.72

5 years ago

0.3.71

5 years ago

0.3.70

5 years ago

0.3.69

5 years ago

0.3.68

5 years ago

0.3.67

5 years ago

0.3.64

5 years ago

0.3.63

5 years ago

0.3.66

5 years ago

0.3.65

5 years ago

0.3.62

5 years ago

0.3.61

5 years ago

0.3.60

5 years ago

0.3.59

5 years ago

0.3.58

5 years ago

0.3.57

5 years ago

0.3.56

5 years ago

0.3.55

5 years ago

0.3.54

5 years ago

0.3.53

5 years ago

0.3.52

5 years ago

0.3.51

5 years ago

0.3.50

5 years ago

0.3.49

5 years ago

0.3.48

5 years ago

0.3.47

5 years ago

0.3.46

5 years ago

0.3.45

5 years ago

0.3.44

5 years ago

0.3.43

5 years ago

0.3.42

5 years ago

0.3.41

5 years ago

0.3.40

5 years ago

0.3.39

5 years ago

0.3.38

5 years ago

0.3.37

5 years ago

0.3.36

5 years ago

0.3.35

5 years ago

0.3.34

5 years ago

0.3.33

5 years ago

0.3.32

5 years ago

0.3.31

5 years ago

0.3.30

5 years ago

0.3.29

5 years ago

0.3.28

5 years ago

0.3.27

5 years ago

0.3.26

5 years ago

0.3.25

5 years ago

0.3.24

5 years ago

0.3.23

5 years ago

0.3.22

5 years ago

0.3.21

5 years ago

0.3.20

5 years ago

0.3.19

5 years ago

0.3.18

5 years ago

0.3.17

5 years ago

0.3.14

5 years ago

0.3.10

5 years ago

0.3.9

5 years ago

0.3.8

5 years ago

0.3.7

5 years ago

0.3.6

5 years ago

0.3.5

5 years ago

0.3.4

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.0.35

6 years ago

0.0.34

6 years ago

0.0.33

6 years ago

0.0.32

6 years ago

0.0.31

6 years ago

0.0.30

6 years ago

0.0.29

6 years ago

0.0.28

6 years ago

0.0.27

6 years ago

0.0.26

6 years ago

0.0.25

6 years ago

0.0.24

6 years ago

0.0.23

6 years ago

0.0.22

6 years ago

0.0.21

6 years ago

0.0.20

6 years ago

0.0.19

6 years ago

0.0.18

6 years ago

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago