AzureB2C MsalProvider issues

Hi.

I'm using Azure B2C (Microsoft provides MsalProvider for react apps) as the auth provider for my application but I keep getting this error in the console below when running the app. I think this is also causing some other problems, i.e. double requests when changing between pages. I understand this is a fairly vague question I just wondered if anybody had hit similar issues or knew of something I could try?

react-dom.development.js:86 Warning: Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://reactjs.org/link/rules-of-hooks
    at mn (http://localhost:3000/static/js/bundle.js:130292:19)
    at SnackbarProvider (http://localhost:3000/static/js/bundle.js:172181:24)
    at http://localhost:3000/static/js/bundle.js:26377:66
    at InnerThemeProvider (http://localhost:3000/static/js/bundle.js:87859:70)
    at ThemeProvider (http://localhost:3000/static/js/bundle.js:86859:5)
    at ThemeProvider (http://localhost:3000/static/js/bundle.js:87879:5)
    at App (http://localhost:3000/static/js/bundle.js:62:65)
    at MsalProvider (http://localhost:3000/static/js/bundle.js:25279:5)

My index.tsx is using the MsalProvider (from Microsoft) like this:

const msalInstance = new PublicClientApplication(msalConfig);

root.render(
  <React.StrictMode>
    <MsalProvider instance={msalInstance}>
      <App />
    </MsalProvider>
  </React.StrictMode>
);
Was this page helpful?