marmelab/react-admin · warning

You passed true to the loginPage prop. You must either pass

Error message

You passed true to the loginPage prop. You must either pass false to disable it or a component class to customize it

What it means

In development, Admin warns when the loginPage prop is set to the boolean true. The loginPage prop only accepts false (to disable the login page) or a React component (to replace the default login page); true is meaningless because react-admin cannot render the boolean as a page. The warning is suppressed in production builds.

Source

Thrown at packages/react-admin/src/Admin.tsx:127

        disableTelemetry,
        error,
        i18nProvider = defaultI18nProvider,
        layout,
        lightTheme,
        loading,
        loginPage,
        notification,
        queryClient,
        ready,
        requireAuth,
        routerProvider,
        store = defaultStore,
        theme,
        title = 'React Admin',
    } = props;

    if (loginPage === true && process.env.NODE_ENV !== 'production') {
        console.warn(
            'You passed true to the loginPage prop. You must either pass false to disable it or a component class to customize it'
        );
    }

    return (
        <AdminContext
            authProvider={authProvider}
            basename={basename}
            darkTheme={darkTheme}
            dataProvider={dataProvider}
            defaultTheme={defaultTheme}
            i18nProvider={i18nProvider}
            lightTheme={lightTheme}
            queryClient={queryClient}
            routerProvider={routerProvider}
            store={store}
            theme={theme}
        >

View on GitHub (pinned to 051f511bb0)

Solutions

  1. Remove the loginPage prop entirely — the default login page is rendered automatically, no need for true.
  2. Pass loginPage={false} to disable the login page.
  3. Pass a component: <Admin loginPage={MyLogin} ...> to customize it.
  4. Check any conditional logic producing the value and make sure it yields a component or false, not true.

Example fix

// before
<Admin loginPage={true} authProvider={authProvider}>

// after (default login page)
<Admin authProvider={authProvider}>

// or custom login page
<Admin loginPage={MyLoginPage} authProvider={authProvider}>
Defensive patterns

Strategy: type-guard

Validate before calling

const isValidLoginPage = (p: unknown): boolean =>
  p === undefined || p === false || (typeof p === 'function' && typeof p !== 'boolean');
if (!isValidLoginPage(props.loginPage)) throw new Error('loginPage must be false or a component');

Type guard

const isComponent = (v: unknown): v is React.ComponentType =>
  typeof v === 'function' || (typeof v === 'object' && v !== null && 'render' in v);

Prevention

When it happens

Trigger: Passing loginPage={true} (or loginPage as an untyped/unknown value coerced to true, e.g. a truthy non-component like an empty string from a boolean flag) to <Admin>.

Common situations: Misreading documentation and thinking true means 'enable the default login page'; conditional props like loginPage={hasAuth && true} where a component was intended; legacy code after a refactor where the custom Login component was removed, leaving the boolean flag.

Related errors


AI-assisted analysis of marmelab/react-admin@051f511bb0 (2026-08-30). Data as JSON: /api/errors/53a4d1673c37164d. Report an issue: GitHub.