Skip to content

Instantly share code, notes, and snippets.

@mbvissers
Created December 29, 2020 18:14
Show Gist options
  • Save mbvissers/b98c2165a283135b35ffb87536f8cb82 to your computer and use it in GitHub Desktop.
Save mbvissers/b98c2165a283135b35ffb87536f8cb82 to your computer and use it in GitHub Desktop.
import Realm from "realm";
// Declare Schema
class BookSchema extends Realm.Object {}
BookSchema.schema = {
name: 'Book',
properties: {
title: 'string',
pages: 'int',
edition: 'int?'
}
};
// Create realm
let realm = new Realm({schema: [BookSchema], schemaVersion: 1});
// Export the realm
export default realm;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment