> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://sdk.railnet.org/api/mcp` to find what you need.

# useGrantScopedRole

React mutation hook for granting a scoped role on the ExternalAccessControl.

## Import

```ts
import { useGrantScopedRole } from '@railnetorg/railnet-sdk/react'
```

## Usage

```tsx
import { useGrantScopedRole } from '@railnetorg/railnet-sdk/react'
import { VEHICLE_STEAM_DEPOSIT } from '@railnetorg/railnet-sdk'

function GrantRole() {
  const { mutateAsync, isPending } = useGrantScopedRole()

  const handleGrant = async () => {
    await mutateAsync({
      accessControl: '0x...',
      role: VEHICLE_STEAM_DEPOSIT,
      scope: '0x...',
      grantee: '0x...',
      account: '0x...',
    })
  }

  return (
    <button disabled={isPending} onClick={handleGrant}>
      Grant Role
    </button>
  )
}
```

## Returns

```ts
UseMutationResult<Hash, Error, GrantScopedRoleParameters & { account: Address }>
```

Mutation result. Call `mutate` or `mutateAsync` with [`grantScopedRole`](/actions/grantScopedRole) parameters.
