this.state added

This commit is contained in:
snoop 2017-07-20 18:14:40 +09:00
parent 8e4b42b860
commit 8d50feb4ac
2 changed files with 11 additions and 15 deletions

View File

@ -14,28 +14,28 @@ export interface DispatchProps {
onReadAllByTarget?(target: Target): void; onReadAllByTarget?(target: Target): void;
} }
export type Props = StateProps & DispatchProps; export type SensorListProps = StateProps & DispatchProps;
export interface State { export interface SensorListState {
isDetail: boolean; isDetail: boolean;
selected: Sensor; selected: Sensor;
} }
export class SensorList extends React.Component<Props, State> { export class SensorList extends React.Component<SensorListProps, SensorListState> {
private data: any; private data: any;
constructor(props: Props, context: State) { constructor(props: SensorListProps, context: SensorListState) {
super(props, context); super(props, context);
// this.state = { this.state = {
// selected: null, selected: null,
// isDetail: false, // temp isDetail: false, // temp
// }; };
} }
public componentWillMount(): void { public componentWillMount(): void {
super.componentWillMount(); // super.componentWillMount();
this.data = [ this.data = [
{ {
'id': '111', 'id': '111',
@ -116,7 +116,7 @@ export class SensorList extends React.Component<Props, State> {
public render(): JSX.Element { public render(): JSX.Element {
if (this.state.isDetail) { if (this.state.isDetail) {
return <SensorDetail sensor={this.state.selected} />; return (<SensorDetail sensor={this.state.selected} />);
} }
return ( return (
<Container fluid> <Container fluid>
@ -152,10 +152,6 @@ export class SensorList extends React.Component<Props, State> {
); );
} }
private onReadAllByTarget(): void {
console.log('');
}
} }