So another announcement from React.js Conf was Realm for React Native. I hadn’t heard about Realm before, but apparently they’re a YCombinator startup with the following value prop:
Realm is a mobile database hundreds of millions of people rely on
And they also say:
Realm is a replacement for SQLite & Core Data
Looking through the overview, from a functionality standpoint, it provides a pretty impressive interface for defining schemas for objects, writing objects and the ability to query for objects. Definitely friendlier than the default AyncStorage that comes with React Native. And looking at the sample code they provided makes it look really easy to use:
class Person {}
Person.schema = {
name: 'Person',
properties: {
name: {type: 'string'},
cars: {type: 'list', objectType: 'Car'},
picture: {type: 'data', optional: true}, // optional property
}
};
I think I’ll try to replace AsyncStorage with this. The only downside is that Realm for React Native requires React Native v0.20 and I think I’m still on v0.14. While it’s nice how things like React and React Native move so quickly, it would be nice if they were more stable with fewer “major” versions (I put major in quotes since v0.20 is technically a minor update, but because it’s pre-1.0, it’s functionality a major version with breaking changes). Anyways, not the point of this post – the point is that Realm for React Native looks cool, I’m going to try it out and I will write my impressions once I get it integrated (after upgrading to RN v0.20).