import React, { PureComponent } from 'react'; export interface IProps { month: void|number, year: void|number, lang: string, onNext: () => any, onPrev: () => any, onValueClick: () => any, } class Head extends PureComponent { selectedValue(): string|number { const { month, year } = this.props; if (typeof year != 'number') { return ''; } else if (typeof month != 'number') { return year; } else { const monthVal = month < 10 ? '0' + month : month; if (this.props.lang == "ja") { return year + '/' + monthVal; } return monthVal + '/' + year; } }; render(): JSX.Element { return (
<
{this.selectedValue()}
>
) } } export default Head;