I am trying to add a to in my local storage using realm when I click the add button, here is my code as I've I was following the documentation and tried to tweak it my own way
const addToDo = () => {
Realm.open({
schema: [
'Todo',
{
properties: {
name: 'string',
},
},
],
})
.then((realm) => {
realm.write(() => {
realm.create('Todo', {name: todo});
// realm.close();
});
setData({realm});
})
.catch((err) => console.log(err));
};