BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Realm Launches New Database for React Native

Realm Launches New Database for React Native

Bookmarks

Realm has launched a new database for React Native, Facebook's platform for building React apps with JavaScript.

The mobile database from Realm is designed to "enable reactive app development, with live objects, change events, and support for unidirectional data flows" and aims to allow developers using Facebook’s JavaScript framework to quickly model, store, and query data through an intuitive interface specifically designed for JavaScript.

Realm React Native looks like this:

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

Announcing the company's move into JavaScript, Tim Anglade, VP of product at Realm, said “React Native mirrors some of our most important priorities at Realm: enabling a native UI experience and reactive cross platform functionality that accelerates the development process and empowers developers,”

“As we see increased demand from our customers for React Native compatibility, we are excited to be the first third-party platform to offer integrated support,” Anglade said.

Already using the integrated database is the errand outsourcing startup TaskRabbit. Brian Leonard, company co-founder and chief architect for TaskRabbit, said managing the code for app across platforms was previously "exhausting," but using Realm and React Native had allowed them to port the app to a seamless cross-platform system. The change has quadrupled the team's productivity, Leonard said.

Describing itself as the fastest React Native database, Realm have published benchmarks commenting "although we always recommend everyone test their own use-cases, we usually see huge speedups when porting code."

Realm's announcement was met favourably by many in the developer community, including attendees of Facebook’s React.js Conference who took to Twitter to comment on the news.

Commenting on a link to the announcement on Hacker News, TaskRabbit's Brian Leonard was first to congratulate the Realm team, saying "We've been really happy trying it out. It's a drop-in replacement for the standard flux pattern." Realm contributor Kristian Dupont also commented "I think this is a very exciting match for both eco systems. I look forward to seeing where it will go."

The Realm team note that they plan to add support for Cordova/PhoneGap/Ionic, and Node.js (V8) compatibility in the future.

Rate this Article

Adoption
Style

BT