title: How to use Realm with React Native?
body: <p>I've tried to use Realm in my project with very little success and I'm lost with this. </p>
  
  <p>I followed this tutorial: <a href="https://medium.com/@bosung90/tackling-react-native-storage-part-1-d27b2bfa480f" rel="nofollow noreferrer">https://medium.com/@bosung90/tackling-react-native-storage-part-1-d27b2bfa480f</a> with no luck, and also the official documentation: <a href="https://realm.io/docs/javascript/latest/#queries" rel="nofollow noreferrer">https://realm.io/docs/javascript/latest/</a></p>
  
  <p>Defining a realm and writing to it seems to work, but I can't read data from it. </p>
  
  <p>My code for creating the database:</p>
  
  <pre><code>const userSchema = {
  name:'User',
  properties:{
      name:'string',
      phone:'string',
      loggedIn:{type:'bool', default:false}
  }
  };
  const realm = new Realm({schema: [userSchema]});
  </code></pre>
  
  <p>And here's the reading function:</p>
  
  <pre><code>export function getUsers(){
  Realm.open({schema: [userSchema]})
  .then(realm =&gt; {
          const users = realm.objects('User');
          return users;
  });
  </code></pre>
  
  <p>}</p>
  
  <p>So here are some questions:</p>
  
  <ol>
  <li><p>In the getUsers function, realm.objects does not return any results, but instead:</p>
  
  <p>Proxy {-1: undefined, Symbol(realm): 10, Symbol(id): 14, Symbol(type): "results", …}
  [[Handler]]:Object
  [[Target]]:Results
  [[IsRevoked]]:false</p></li>
  </ol>
  
  <p>How can I get the actual results instead?</p>
  
  <ol start="2">
  <li><p>Do I have to use <code>Realm.open()</code> every time I do anytihing with the database?</p></li>
  <li><p>Can someone give an example of code and files where Realm DB is created, data is written and data is fetched, please?</p></li>
  </ol>
  
  <p>Any kind of help is highly appreciated.</p>