Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createTodoStore(snapshot) {
// clean up snapshot listener
if (snapshotListener) snapshotListener()
// kill old store to prevent accidental use and run clean up hooks
if (store) destroy(store)
// create new one
store = TodoStore.create(snapshot)
// connect devtools
connectReduxDevtools(require("remotedev"), store)
// connect local storage
snapshotListener = onSnapshot(store, snapshot =>
localStorage.setItem(localStorageKey, JSON.stringify(snapshot))
)
return store
}