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

# useIsMfaRequiredForAction

<Card title="Recommended: JavaScript SDK with React Hooks" icon="react" color="#4779FE">
  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)](/docs/javascript/reference/react-quickstart) to get started.
</Card>

### Summary

This hook provides a way for clients to check if MFA is required for an action.

The hook needs to be initialized within a child of [DynamicContextProvider](/docs/react/reference/providers/dynamiccontextprovider).

### Usage

Available methods:

* `isMfaRequiredForAction`: Check if MFA is required for an action. Returns a boolean value indicating whether MFA is required for the action.

### Usage

```TypeScript theme={"system"}
import { useIsMfaRequiredForAction, MFAAction } from '@dynamic-labs/sdk-react-core';

const App = () => {
  const isMfaRequiredForAction = useIsMfaRequiredForAction();

  const handleCheckMfaRequiredForAction = async () => {
    const isMfaRequired = await isMfaRequiredForAction({
      mfaAction: MFAAction.WalletWaasSign, // Specify action configured for Action-Based MFA
    });
    console.log('MFA is required for action:', isMfaRequired);
  };

  return (
    <button
      onClick={() => handleCheckMfaRequiredForAction()}
    >
      Check if MFA is required for an action
    </button>
  );
};
```
