Skip to content

Commit 16d221e

Browse files
committed
added configuration code examples
1 parent dc7c2f1 commit 16d221e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

source/frameworks/react/providers-hooks.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,27 @@ Provider has different props you can use for configuration.
5959
The most common BaseConfiguration properties used are:
6060

6161
- ``schema?: (RealmObjectConstructor<AnyRealmObject> | ObjectSchema)[]``
62+
6263
Specifies all the object schemas in this Realm. Required when first creating a Realm.
6364
If omitted, the schema will be read from the existing Realm file.
6465

6566
- ``sync?: SyncConfiguration``
67+
6668
Configures a synced realm.
6769

6870
``RealmProvider`` has more props that define its behavior:
6971

7072
- ``fallback?: React.ComponentType<unknown> | React.ReactElement | null | undefined``
73+
7174
The fallback component to render while the Realm is opening.
7275

7376
- ``closeOnUnmount?: boolean``
77+
7478
Default is ``true``. If set to ``false``, realm will not close when the
7579
component unmounts.
7680

7781
- ``realmRef?: React.MutableRefObject<Realm | null>``
82+
7883
A ref to the realm instance. This is useful if you need to access the realm
7984
instance outside of the scope of the realm.
8085

@@ -145,7 +150,8 @@ to configure a realm or exposing more than one realm, refer to their respective
145150
You *must* nest the Providers and app components as shown below to ensure each component
146151
has access to its required context:
147152

148-
[Code example here]
153+
.. literalinclude:: /examples/generated/react-native/ts/configure-realm-sync.test.snippet.configure-realm-sync-full.tsx
154+
:language: javascript
149155

150156
.. tab:: Configure realm without sync
151157
:tabid: configure-non-sync-realm
@@ -163,7 +169,8 @@ to configure a realm or exposing more than one realm, refer to their respective
163169
Once your ``RealmProvider`` has been configured, nest your app components within it to
164170
give them access to the realm opened.
165171

166-
[code example - unsynced]
172+
.. literalinclude:: /examples/generated/react-native/ts/configure-realm-local.test.snippet.configure-realm.tsx
173+
:language: typescript
167174

168175

169176
Working with Providers using Hooks

0 commit comments

Comments
 (0)