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

# useReinitialize

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

<Warning>
  Available from SDK V3.0+
</Warning>

## Summary

Used to manually reinitialize the whole SDK at any point in time. It will reset not just the user state (as [useRefreshUser](/react/reference/hooks/login-user-management/userefreshuser) does), but the whole SDK state including wallets, the primaryWallet, user state, etc.

An example of where this hook can be helpful is 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.

While in process, the `sdkHasLoaded` boolean on [`useDynamicContext`](/react/reference/hooks/usedynamiccontext) will be false, and once completed, it will be true.

## Usage

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

const ReInitButton = () => {
  const reinitialize = useReinitialize();

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

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