# reconnect

Restore a stored WalletConnect session.

`reconnect` restores an existing session, for example one persisted from a previous visit (see `storage` in [Configuration](/docs/integration/configuration)).

```ts
const { actions, session } = useProvider();
const { error } = await actions.reconnect(session);
```

## Parameters

```ts
session: SessionTypes.Struct // the WalletConnect session to restore
```

## Returns

```ts
Promise<{ data: unknown; error: Error | null }>
```

## Example

```tsx
'use client';

import { useProvider } from './provider';

export function ReconnectButton() {
  const { actions, session } = useProvider();

  const handleReconnect = async () => {
    if (!session) return;
    const { error } = await actions.reconnect(session);
    if (error) throw error;
  };

  return <button onClick={handleReconnect}>Reconnect</button>;
}
```

> [!TIP]
> If Joey ended the session (for example because the user switched account), reconnecting won't bring it back. Call [`connect`](/docs/integration/actions/connect) instead.
