add key to react components
This commit is contained in:
@@ -13,7 +13,11 @@ class App extends Component {
|
|||||||
<Switch>
|
<Switch>
|
||||||
{
|
{
|
||||||
mainMenuItems.map(mainMenuItem =>
|
mainMenuItems.map(mainMenuItem =>
|
||||||
<Route exact path={mainMenuItem.url} component={mainMenuItem.component} />)
|
<Route key={mainMenuItem.id}
|
||||||
|
exact
|
||||||
|
path={mainMenuItem.url}
|
||||||
|
component={mainMenuItem.component}
|
||||||
|
/>)
|
||||||
}
|
}
|
||||||
<Route component={NotFound} />
|
<Route component={NotFound} />
|
||||||
</Switch>
|
</Switch>
|
||||||
|
|||||||
@@ -8,7 +8,13 @@ const MainMenu = () =>
|
|||||||
(<Menu>
|
(<Menu>
|
||||||
{
|
{
|
||||||
mainMenuItems.map(mainMenuItem =>
|
mainMenuItems.map(mainMenuItem =>
|
||||||
<Menu.Item as={NavLink} to={mainMenuItem.url} exact>{mainMenuItem.title}</Menu.Item>)
|
<Menu.Item key={mainMenuItem.id}
|
||||||
|
as={NavLink}
|
||||||
|
to={mainMenuItem.url}
|
||||||
|
exact
|
||||||
|
>
|
||||||
|
{mainMenuItem.title}
|
||||||
|
</Menu.Item>)
|
||||||
}
|
}
|
||||||
</Menu>);
|
</Menu>);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user