add key to react components
This commit is contained in:
@@ -13,7 +13,11 @@ class App extends Component {
|
||||
<Switch>
|
||||
{
|
||||
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} />
|
||||
</Switch>
|
||||
|
||||
@@ -8,7 +8,13 @@ const MainMenu = () =>
|
||||
(<Menu>
|
||||
{
|
||||
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>);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user