Documentation Index
Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
Use this file to discover all available pages before exploring further.
React Native provides the ability to switch the user’s primary wallet through the wallets.setPrimary() method on the dynamic client.
You can access the current primary wallet and switch to a different one using the reactive client:
import { FC } from 'react';
import { dynamicClient } from '<path to client file>';
import { useReactiveClient } from '@dynamic-labs/react-hooks';
import { View, Text, TouchableOpacity } from 'react-native';
const SetFirstWalletRN: FC = () => {
const { wallets } = useReactiveClient(dynamicClient);
return (
<View>
<Text>Current primary wallet: {wallets.primary?.address}</Text>
<TouchableOpacity
onPress={() => wallets.setPrimary({ walletId: wallets.userWallets[0].id })}
>
<Text>Set first wallet as primary</Text>
</TouchableOpacity>
</View>
);
};