Skip to content

Instantly share code, notes, and snippets.

@malerba118
Created February 17, 2019 00:23
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 malerba118/a05777cb4c49d37d8b6e4953f6be43d7 to your computer and use it in GitHub Desktop.
Save malerba118/a05777cb4c49d37d8b6e4953f6be43d7 to your computer and use it in GitHub Desktop.
Creating the Database
import { schema } from "normalizr";
import createDB from "react-use-database";
let TodoSchema = new schema.Entity("Todo");
let models = [TodoSchema];
let [ DatabaseProvider, useDB ] = createDB(
models,
{
storedQueryDefinitions: {
ALL_TODOS: {
schema: [TodoSchema],
defaultValue: []
},
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment