I'm having this error when trying to use the custom login page from the react-admin official docs.
index.js:1 Warning: Failed prop type: The prop `theme` is marked as required in
`ThemeProvider`, but its value is `undefined`.
In MyLoginPage.js, I have this code
import * as React from 'react';
import { useState } from 'react';
import { useLogin, useNotify, Notification } from 'react-admin';
import { ThemeProvider } from '@material-ui/styles';
const MyLoginPage = ({ theme }) => {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const login = useLogin();
const notify = useNotify();
const submit = (e) => {
e.preventDefault();
login({ email, password })
.catch(() => notify('Invalid email or password'));
};
return (
<ThemeProvider theme={theme}>
<form onSubmit={submit}>
<input
name="email"
type="email"
value={email}
onChange={e => setEmail(e.target.value)}
/>
<input
name="password"
type="password"
value={password}
onChange={e => setPassword(e.target.value)}
/>
</form>
<Notification />
</ThemeProvider>
);
};
export default MyLoginPage;
Can you help me to see what is wrong?
I'm following the docs to learn the Framework.
This is the link to the React Admin page.