Realm for React Native: fast database with live objects, change events & support for unidirectional data flows

If you ever worked on native Mobile Apps before and you looked for alternatives to SQLite or key-value stores then you already heard about Realm.
The good news is that the guys at Realm are now launching a new Realm mobile database built specifically for React Native.

If you're working your way around persistence, then this surely will breathe new life into your project.

Introducing Realm React Native

realm-js on GitHub

At Facebook’s React.js Conference, we’re launching a new Realm mobile database built specifically for React Native. It offers easy object persistence and full query capabilities, with a performance profile that’s usually 2–10x faster than existing options.

Like the other editions of Realm, it is designed from the ground up to enable reactive app development, with live objects, change events, and support for unidirectional data flows

const Realm = require("realm");

class Person {}
Person.schema = {
  name: "Person",
  primaryKey: "name",
  properties: {
    name: "string",
    age: { type: "int", default: 0 },
  },
};

const realm = new Realm({ schema: [Person] });

// Query
let people = realm.objects("Person", "age >= 17");
people.length; // => 0

// Write
realm.write(() => {
  savedPerson = realm.create("Person", {
    name: "Hal Incandenza",
    age: 17,
  });
});

// Queries are updated in real-time
people.length; // => 1