> ## 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.

# Handlers Introduction

> [card] Recommended: JavaScript SDK with React Hooks
>
> For new React apps, we recommend the JavaScript SDK with React Hooks (`@dynamic-labs-sdk/react-hooks`) instead of the legacy React SDK documented here. The JS SDK comes with many benefits such as a much smaller bundle size and other optimizations. Use the [React quickstart (JavaScript SDK)](https://docs.dynamic.xyz/docs/javascript/reference/react-quickstart.md) to get started.

Handlers is a way to programmatically customize synchronous behaviors in the SDK.
They allow running code synchronously and wait until completion, unlike [**Events**](https://docs.dynamic.xyz/docs/react/reference/events/events-introduction.md) that run a-synchronous and do not block the authentication flow.

Handlers are configured in the DynamicContextProvider:

```tsx theme={"system"}
<DynamicContextProvider
  settings={{
    handlers: {
      // handles callbacks go here
    },
  }}
>
  ...
</DynamicContextProvider>
```

[**handleConnectedWallet**](https://docs.dynamic.xyz/docs/react/reference/handlers/handleconnectedwallet.md): Handler that runs before Dynamic establishes a wallet connection (Connect wallet before the authentication step).
For example This is a good place to run compliance checks.

[**handleAuthenticatedUser**](https://docs.dynamic.xyz/docs/react/reference/handlers/handleauthenticateduser.md): Handler that runs after the user authenticated but before Dynamic's finished the authentication flow.
For example: It is a good place to perform blocking actions with the user on your backend before Dynamic's SDK finished the authentication flow.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.