Last active
September 9, 2018 13:37
-
-
Save GarethOates/3e5d3b23ea3759d48ba6ebebdd4a32d4 to your computer and use it in GitHub Desktop.
Creation of a Drizzle Redux Store
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Drizzle, generateStore } from 'drizzle'; | |
import options from './drizzleOptions'; | |
const drizzleStore = generateStore(options); | |
const drizzle = new Drizzle(options, drizzleStore); | |
drizzleStore.subscribe(() => { | |
const state = drizzleStore.getState(); | |
// We'll make use of this state object later on when | |
// we have a front-end component which uses it. | |
}); | |
// This is not necessary, but I find it useful to be able to interact with these objects | |
// from the console window when I'm trying things out and debugging. | |
window.drizzle = drizzle; | |
window.store = drizzleStore; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment