@dynamic-labs/react-hooks
v3.9.5
Published
This library provides an React integration to the Dynamic SDK client. Allows to you app to use and automatically update when the Dynamic SDK client is updated.
Downloads
3,041
Readme
react-hooks
This library provides an React integration to the Dynamic SDK client. Allows to you app to use and automatically update when the Dynamic SDK client is updated.
Installation
npm install @dynamic-labs/react-hooks
Usage
import { useDynamicClient, DynamicClientProvider } from '@dynamic-labs/react-hooks';
import { createClient } from '@dynamic-labs/client';
import { View, Text } from 'react-native';
const dynamicClient = createClient({...})
const MyComponent = () => {
const { auth } = useDynamicClient();
return (
<View>
<Text>{auth.authenticatedUser?.username}</Text>
</View>
)
}
const App = () => {
return (
<DynamicClientProvider client={dynamicClient}>
<MyComponent />
</DynamicClientProvider>
);
};