> ## Documentation Index
> Fetch the complete documentation index at: https://www.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# useRefreshUser

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

## Summary

Used to manually refresh the user state at any point in time, for example if you have multiple separate windows (things like a Chrome extension popup and a Chrome page for the same extension) where Dynamic is active and you want to ensure they are all in sync.

The SDK state as a whole will be maintained i.e. the `sdkHasLoaded` boolean on `useDynamicContext` will stay true. If you want to reset the whole SDK including wallets, then take a look at [`useReinitialize`](/react/reference/hooks/usereinitialize).

## Usage

```tsx theme={"system"}
import {
  DynamicContextProvider,
  useRefreshUser,
} from '@dynamic-labs/sdk-react-core';

const RefreshButton = () => {
  const refresh = useRefreshUser();

  return (
    <button onClick={refresh}>Reinitialize</button>
  );
}

const App = () => {
  return (
    <DynamicContextProvider>
      <RefreshButton />
    </DynamicContextProvider>
  )
}
```

## FAQs

What does an error response look like?

* Generic Error with the message: "useRefreshUser resulted in an invalid user: no verified credentials found"

When exectly is the JWT updated?

* The JWT is only updated on success. On failure, nothing is mutated, so the existing JWT remains as-is (still usable until it actually expires)

Is there a client-side rate limit?

* No, there's no client-side limit, so it would come down to [general rate limits](/overview/rate-limits) at that point.
