Hello dear community.
I have the following component in react native (simplified):
function PostsScreen() {
const realm = useRealm();
const posts = useQuery(Post);
console.log(posts.at(0).visits);
const addOne = () => {
realm.write(() => {
posts.at(0).visits += 1;
});
}
return <Pressable onPress={addOne}>Click</Pressable>
}
This realm has 5000 posts. THe problem is that whenever I click on the button, the component is updated (and the console.log prints the new value) after ~1 second which feels like a lag.
Am I missing something?
Thank you