class TabBar extends React.Component {
handleClick(event) {
if (!this.props.onSelectedIndexChange) return;
const el = event.target;
const index = el.parentNode.children.indexOf(el);
this.props.onSelectedIndexChange(index);
}
render() {
const index = this.props.selectedIndex;
return (
);
}
}
TabBar.defaultProps = {selectedIndex: 0};
TabBar = controllable(TabBar, ['selectedIndex']);