react-admin Menu.DashboardItem unique key warning

Viewed 51

I'm trying to create a simple react-admin application The code I have looks like this:

const App = () => (
    <Admin dashboard={Dashboard} authProvider={authProvider} dataProvider={dataProvider}>
        <Resource name="Segments" list={SegmentsList} />
    </Admin>
);

When the application runs I can see such message in browser console:

Warning: Each child in a list should have a unique "key" prop.

Check the render method of `Menu`. See https://reactjs.org/link/warning-keys for more information.
    at DashboardMenuItem (http://localhost:3000/static/js/bundle.js:94915:22)
    at Menu (http://localhost:3000/static/js/bundle.js:95707:82)

I understand that "render" method somewhere inside react-admin has a loop where key prop is not used. Is it a way to avoid the warning without creating my own menu component where I can use the key attribute?

Dashboard component mentoned in the warning is quite simple and should not have any issue like one described - I got the code from react-admin documentation/tutorial

const Dashboard = () => (
    <Card>
        <CardHeader title="Welcome to the administration" />
        <CardContent>Lorem ipsum sic dolor amet...</CardContent>
    </Card>
);

When I removed the dashboard attribute of <Admin ...> component the warning disappeared

0 Answers
Related