diff --git a/source/frameworks/react/providers-hooks.txt b/source/frameworks/react/providers-hooks.txt index 7e7bba9bed..5e5b5609d9 100644 --- a/source/frameworks/react/providers-hooks.txt +++ b/source/frameworks/react/providers-hooks.txt @@ -59,24 +59,24 @@ Provider has different props you can use for configuration. The most common BaseConfiguration properties used are: - ``schema?: (RealmObjectConstructor | ObjectSchema)[]`` - Specifies all the object schemas in this Realm. Required when first creating a Realm. - If omitted, the schema will be read from the existing Realm file. + Specifies all the object schemas in this Realm. Required when first creating a Realm. + If omitted, the schema will be read from the existing Realm file. - ``sync?: SyncConfiguration`` - Configures a synced realm. + Configures a synced realm. ``RealmProvider`` has more props that define its behavior: - ``fallback?: React.ComponentType | React.ReactElement | null | undefined`` - The fallback component to render while the Realm is opening. + The fallback component to render while the Realm is opening. - ``closeOnUnmount?: boolean`` - Default is ``true``. If set to ``false``, realm will not close when the - component unmounts. + Default is ``true``. If set to ``false``, realm will not close when the + component unmounts. - ``realmRef?: React.MutableRefObject`` - A ref to the realm instance. This is useful if you need to access the realm - instance outside of the scope of the realm. + A ref to the realm instance. This is useful if you need to access the realm + instance outside of the scope of the realm. - ``children: React.ReactNode`` @@ -89,14 +89,14 @@ Provider has different props you can use for configuration. The most common AppConfiguration property used is: - ``id: string`` - Specifies the App ID. + Specifies the App ID. .. tab:: UserProvider Props :tabid: user-provider-props - ``fallback?: React.ComponentType | React.ReactElement | null | undefined`` - The fallback component to render if there is no authorized user. This can be - used to render a log in screen or otherwise handle authentication. + The fallback component to render if there is no authorized user. This can be + used to render a log in screen or otherwise handle authentication. Configure your Providers ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -105,14 +105,13 @@ This section details how to configure and expose a single realm using a ``RealmP imported directly from ``@realm/react``. For information about using ``createRealmContext()`` to configure a realm or exposing more than one realm, refer to their respective sections below. -If you are developing an app using sync, you will need to use all three Providers. If you are -developing an app without sync, you only need to use ``RealmProvider``. - .. tabs:: .. tab:: Configure realm with sync :tabid: configure-sync-realm + If you are developing an app using sync, you will need to use all three Providers. + By default, Realm syncs all data from the server before returning anything. If you want to sync data in the background, read Configure a Synced Realm While Offline [link]. @@ -150,6 +149,8 @@ developing an app without sync, you only need to use ``RealmProvider``. .. tab:: Configure realm without sync :tabid: configure-non-sync-realm + If you are developing an app without sync, you only need to use ``RealmProvider``. + To configure a non-synced realm: #. Import ``RealmProvider`` from ``@realm/react``. @@ -164,8 +165,8 @@ developing an app without sync, you only need to use ``RealmProvider``. [code example - unsynced] -Working in your Providers -------------------------- +Working with Providers using Hooks +---------------------------------- To use the Provider's context in your app's components, you can use hooks [link].