Search code examples
react-nativerealm

How do I find the realm path in react-native?


I am trying to find the realm path for the react-native application I am writing. There are examples for Swift and Android to print the realm path, but I couldn't find any for react-native. Can someone please post an example of realm path retrieval using react native?

Thanks.


Solution

  • You can just create your Realm object and do below.

    let realm = new Realm({
         schema: [{name: 'Dog', properties: {name: 'string'}}]
       });
    
       realm.write(() => {
         realm.create('Dog', {name: 'Rex'});
       });
    

    console.log(realm.path);