Use Local Store
Initialize
const [store, select, setStore] = useLocalStore('example-slice')
Set data to the store
You can set data directly to the store using single parameter
setStore({ name: 'dinesh', age: '27' })
With two parameters you can set a data model to specific key reference
setStore('user', { name: 'dinesh', age: '27' })
Retrieve Data from store
You can simply retrieve data from store using 'select()' method. Also, this method can be used to retrieve data from any nested object level
select('name')select('user.name')
If you want to quick access to some specific key reference. Use 'select()' method with two parameters
let user = select('user', select)console.log(user('name')) // dinesh
Local Store Thunk
Sometimes we need to set data models form thunk layer. In such case we can use 'localStore' thunk method
Initialize
const [setStore] = localStore("example-slice")
Set data to the store
dispatch(setStore("user", { name: 'dinesh', age: '27' }))