redux-rewire-live
v1.1.0
Published
## Basic Use ```javascript const {createStore} = require('./redux'); const {rewire} = require('redux-rewire-live')
Downloads
6
Readme
redux-rewire-live
Basic Use
const {createStore} = require('./redux');
const {rewire} = require('redux-rewire-live')
const reducer = (state, action)=>({
currentUserID: 0,
users: [
{
firstName: 'John',
lastName: 'Doe'
},
{
firstName: 'Jane'
lastName: 'Doe'
}
]
})
const store = createStore(reducer)
const currentUser = (state)=>({
...state
currentUser: {
...state.users[state.currentUserID]
}
})
const rewiredStore = rewire(store, currentUser)
rewiredStore.getState().currentUser
// {firstName: 'John', lastName: 'Doe'}
Testing
yarn test