auth0/auth0-react

Uncaught TypeError: l.current is null when using react-dom 18.3.1

tnguyen14 opened this issue · 2 comments

Checklist

Description

React recently released a new version, 18.3.1. In this version of react-dom, using the Auth0Provider throws an error

Uncaught TypeError: l.current is null

Please note that the version of react doesn't matter, i.e. can use either 18.2.0 or 18.3.1. This error happens only with version 18.3.1 of react-dom.

Reproduction

import React from 'https://esm.sh/react@18.3.1';
import { render } from 'https://esm.sh/react-dom@18.3.1';
import { Auth0Provider } from 'https://esm.sh/@auth0/auth0-react@2';

render(
    <Auth0Provider
      domain="auth0.com"
      clientId="<client-id>"
      cacheLocation="localstorage"
      useRefreshTokens={true}
      useRefreshTokensFallback={true}
      authorizationParams={{
        redirect_uri: window.location.href,
        audience: "<api-audience>",
        scope: "openid profile email"
      }}
    >
        <div>Hello World</div>
    </Auth0Provider>,
    document.querySelector(".main")
);

Additional context

No response

auth0-react version

2.2.4

React version

18.3.1

Which browsers have you tested in?

Chrome, Edge, Firefox

ije commented

you may need to add ?deps=react@18.3.1 to https://esm.sh/@auth0/auth0-react@2

import { Auth0Provider } from 'https://esm.sh/@auth0/auth0-react@2?deps=react@18.3.1';

@ije thanks for the suggestion. I tried specifying the deps query parameter, for both versions 18.2.0 and 18.3.1. It doesn't solve the problem, unless the versions of react and react-dom themselves (in the module, not as the query parameter) are pinned to 18.2.0