-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Realm React
-
2 - S (<= 1 week)
-
5292
-
Needed
Problem
It's annoying for users to have to create a Realm context (calling createRealmContext) before accessing the useRealm, useQuery and useObject hooks:
Unable to find source-code formatter for language: tsx. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
import { createRealmContext } from "@realm/react"; const { RealmProvider, useRealm } = createRealmContext(); // use the useRealm hook
Solution
Instead we should create a default Realm context and export its members as named exports, making the average use of the library much simpler:
Unable to find source-code formatter for language: tsx. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
import { RealmProvider, useRealm } from "@realm/react"; // use the useRealm hook
We should make sure to document the advanced use-case of working with multiple Realm's (calling createRealmContext) too.
Alternatives
No response
How important is this improvement for you?
I would like to have it but have a workaround
Feature would mainly be used with
Atlas Device Sync