Skip to content

Version 2.10.0

Compare
Choose a tag to compare
@bluebill1049 bluebill1049 released this 07 Nov 01:02
· 181 commits to master since this release

Feature: sync with external stores in session/local storage:

This feature allows you to sync other stores which was stored in your session/local storage.

createStore({
  yourDetail, // it's an object of your state { firstName: '', lastName: '' }
}, {
  syncStores: { // you can sync with external store and transform the data
    name: 'externalStoreName',
    transform: (externalStore, currentStore) => {
      return { ...externalStore, ...currentStore };
    },
  }
})

or

createStore({
  yourDetail,
}, {
  syncStores: { 
    externalStoreName: ['yourDetail']
  }
})