3.0.2 • Published 2 years ago

redux-rubberstamp v3.0.2

Weekly downloads
6
License
ISC
Repository
github
Last release
2 years ago

Pattern for hosting multiple versions of a component tree inside the main state tree

Installation

Install with npm or yarn:

npm install --save redux-rubberstamp

Usage

Using redux-rubberstamp in your application is easy:

If you only need one instance of the component in your state tree, you can export it as a singleton component:

import { Singleton } from 'redux-rubberstamp'
import reducer from './reducer'
import button from './button'
import * as actions from './actions'
import * as selectors from './selectors'

export default Singleton({
  namespace: 'button',
  component: button,
  reducer,
  actions,
  selectors
})

If you only need multiple instances of the component in your state tree, you can export it as a factory component:

import { Factory } from 'redux-rubberstamp'
import reducer from './reducer'
import button from './button'
import * as actions from './actions'
import * as selectors from './selectors'

export default Factory({
  namespace: 'button',
  component: button,
  reducer,
  actions,
  selectors
})

When you use the component in your react app, you treat it like any default export:

import Button from './components/button'

const () => {
  return <Button />
}

In order to manage the master state tree, redux-rubberstamp provides a custom combineReducers function to manage the components place in the state tree:

import { combineReducers } from 'redux-rubberstamp'
import Button from './button'

export default combineReducers([
  Button
])
3.0.2

2 years ago

3.0.1

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

3.0.0

2 years ago

2.0.0

2 years ago

1.15.0

6 years ago

1.14.0

6 years ago

1.13.0

6 years ago

1.12.0

6 years ago

1.11.0

6 years ago

1.10.1

7 years ago

1.10.0

7 years ago

1.9.0

7 years ago

1.8.0

7 years ago

1.7.0

7 years ago

1.6.0

7 years ago

1.5.0

7 years ago

1.3.3

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.8

7 years ago

1.1.7

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago