You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/api/setupI13n.md
+9
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,15 @@ var I13nDempApp = setupI13n(DemoApp, {
27
27
}, [someReactI13nPlugin]);
28
28
29
29
// then you could use I13nDemoApp to render you app
30
+
31
+
### Create and access the ReactI13n instance
32
+
33
+
What we dowith`setupI13n` is that we will create the `ReactI13n` instance, along with a root node of the I13nTree, passing them via component context to the children.
34
+
35
+
It's designed to work within React components, you should be able to just [utilFuctions](https://github.com/yahoo/react-i13n/blob/master/docs/guides/utilFunctions.md) and trigger i13n events. In case you want to do this out of React components, you can access `window._reactI13nInstance` directly.
36
+
37
+
If you have multiple react trees in one page, we will create multiple i13n trees based on how many react tree you have. On client side the [utilFuctions](https://github.com/yahoo/react-i13n/blob/master/docs/guides/utilFunctions.md) still work based on the global instance object, while on server side, only the children under `setupI13n` can get the react i13n instance as we don't have a proper way to share the reactI13n instance without causing [memory leak](https://github.com/yahoo/react-i13n/pull/100).
0 commit comments