@dynamic-labs/react-hooks 2.0.0-alpha.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/index.js +1648 -0
- package/package.json +14 -0
- package/src/index.d.ts +2 -0
- package/src/lib/context/DynamicClientContext.d.ts +11 -0
- package/src/lib/hooks/useReactivityProxy/index.d.ts +1 -0
- package/src/lib/hooks/useReactivityProxy/useReactivityProxy.d.ts +1 -0
- package/src/lib/types/DefaultClient.d.ts +2 -0
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# react-hooks
|
|
2
|
+
|
|
3
|
+
This library provides an React integration to the Dynamic SDK client.
|
|
4
|
+
Allows to you app to use and automatically update when the Dynamic SDK client is updated.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @dynamic-labs/react-hooks
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { useDynamicClient, DynamicClientProvider } from '@dynamic-labs/react-hooks';
|
|
16
|
+
import { createClient } from '@dynamic-labs/client';
|
|
17
|
+
import { View, Text } from 'react-native';
|
|
18
|
+
|
|
19
|
+
const dynamicClient = createClient({...})
|
|
20
|
+
|
|
21
|
+
const MyComponent = () => {
|
|
22
|
+
const { auth } = useDynamicClient();
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<View>
|
|
26
|
+
<Text>{auth.authenticatedUser?.username}</Text>
|
|
27
|
+
</View>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const App = () => {
|
|
32
|
+
return (
|
|
33
|
+
<DynamicClientProvider client={dynamicClient}>
|
|
34
|
+
<MyComponent />
|
|
35
|
+
</DynamicClientProvider>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
```
|