I get the following error when trying to access data in Atlas: _realm.useQuery is not a function
### Stacktrace & log output
_No response_
### Can you reproduce the bug?
Always
### Reproduction Steps
Code examples provided above. Also some confusion as to when to use either of the following:
import Realm from "realm"
OR
import Realm from "@realm/react"
### Version
12.5.1
### What services are you using?
Both Atlas Device Sync and Atlas App Services
### Are you using encryption?
No
### Platform OS and version(s)
Windows 11
### Build environment
Which debugger for React Native: ..
### Cocoapods version
_No response_
How frequently does the bug occur?
Always
Description
I am attempting to incorporate Realm into a mobile app and am able to successfully use authentication:
import Realm from "realm";
Realm.flags.THROW_ON_GLOBAL_REALM = true;
const app = new Realm.App({ id: "devicesync-xxxxx" });
export default app;
import Realm from "realm";
export class ProjectSchema extends Realm.Object { static primaryKey = "_id"; static schema = { name: "Project", primaryKey: "_id", properties: { _id: "uuid", area: "string", customer: "string", customercontact: "string", rigcompany: "string", projectname: "string", description: "string", projectedstartdate: "date", actualstartdate: "date", expectedduration: "int", actualduration: "int", status: "string", statusdate: "date", comment: "string", latdec: "double", longdec: "double", }, }; }
import { Realm, useQuery, useRealm } from "realm"; import Project from "../models/projectModel";
const ActiveProjects = () => { const [activeProjects, setActiveProjects] = useState([]);
const projectList = useQuery(Project); console.log("projectList", projectList);