Skip to content

Instantly share code, notes, and snippets.

@GarethOates
Last active September 9, 2018 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GarethOates/3e5d3b23ea3759d48ba6ebebdd4a32d4 to your computer and use it in GitHub Desktop.
Save GarethOates/3e5d3b23ea3759d48ba6ebebdd4a32d4 to your computer and use it in GitHub Desktop.
Creation of a Drizzle Redux Store
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