Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Intro to Realm React Native

Intro to Realm React Native

Intro to Realm React Native, presented during the London React Native Community http://www.meetup.com/London-React-Native-Community/events/230142668/

Nabil Hachicha

April 20, 2016
Tweet

More Decks by Nabil Hachicha

Other Decks in Programming

Transcript

  1. Realm A new way to persist & query data on

    React Native Nabil Hachicha @nabil_hachicha
  2. SQLite SELECT * 
 FROM persons p
 INNER JOIN persons

    c ON c.parent_id = p.id ORDER BY name
  3. +

  4. class Person {
 ...
 }
 
 Person.schema = {
 name:

    'Person',
 properties: {
 name: 'string',
 birthday: ‘date'
 }
 }; Realm is not an ORM
  5. // Query results are computed lazily
 let people = realm.objects('Person');


    
 // and can be filtered
 people = people.filtered('birthday < $0', date);
 
 
 

  6. // Query results are computed lazily
 let people = realm.objects('Person');


    
 // and can be filtered
 people = people.filtered('birthday < $0', date); 
 // and sorted
 people = people.sorted('name');

  7. Basic Property Types • bool => Boolean • int, float,

    double => Number • string => String • data => ArrayBuffer • date => Date
  8. ListView Integration import { ListView } from 'realm/react-native';
 
 //

    - Same API as React.ListView
 // - Optimized for Realm collections

  9. • Zero-Copy Architecture • Bitpacking reduces memory usage by up

    to 90% • Caching & Vectorization makes access faster than native C • Universal data representation from multiple languages