Skip to main content
Version: 1.1.x

setConfig()

function to configure the use-redux-states.

config objects#

cleanup.#

boolean value to determine if the state should be deleted when all component that subscribed to a state path have been unmounted from react tree. this is experimental

setter()?#

function to replace the initial use-redux-states setter function.

Example#

import { setConfig } from 'use-redux-states'
setConfig({
cleanup: false,
setter: (stateValue, payload) => {
switch (stateValue?.constructor) {
case Object:
return { ...stateValue, ...payload }
case Array:
return [...stateValue, ...payload]
default:
return payload
}
}
})