unique "key" prop added

This commit is contained in:
crusader 2017-07-25 15:18:57 +09:00
parent bf344fc561
commit 279e507939

View File

@ -61,12 +61,16 @@ export class TitleBar extends React.Component<Props, State> {
public renderBreadcrumb(): JSX.Element[] { public renderBreadcrumb(): JSX.Element[] {
let elems: JSX.Element[] = new Array(); let elems: JSX.Element[] = new Array();
let pathArr = this.props.location.split('/'); let pathArr = this.props.location.split('/');
let index: number = 0;
for (let item of pathArr) { for (let item of pathArr) {
if (item !== '' && !item.match(/^\d+$/)) { if (item !== '' && !item.match(/^\d+$/)) {
let path = '/' + item; let path = '/' + item;
elems.push(<Breadcrumb.Section onClick={this.handleBreadcrumb.bind(this, path)}>{this.capitalizeFirst(item)}</Breadcrumb.Section>); elems.push(
elems.push(<Breadcrumb.Divider />); <Breadcrumb.Section key={index++} onClick={this.handleBreadcrumb.bind(this, path)}>
{this.capitalizeFirst(item)}
</Breadcrumb.Section>);
elems.push(<Breadcrumb.Divider key={index++}/>);
} }
} }
return elems; return elems;