this.state added
This commit is contained in:
parent
8e4b42b860
commit
8d50feb4ac
|
@ -17,7 +17,7 @@ class SensorList extends React.Component<RouteComponentProps<object>, object> {
|
|||
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
<SensorListContainer/>
|
||||
<SensorListContainer />
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,28 +14,28 @@ export interface DispatchProps {
|
|||
onReadAllByTarget?(target: Target): void;
|
||||
}
|
||||
|
||||
export type Props = StateProps & DispatchProps;
|
||||
export type SensorListProps = StateProps & DispatchProps;
|
||||
|
||||
export interface State {
|
||||
export interface SensorListState {
|
||||
isDetail: boolean;
|
||||
selected: Sensor;
|
||||
}
|
||||
|
||||
|
||||
export class SensorList extends React.Component<Props, State> {
|
||||
export class SensorList extends React.Component<SensorListProps, SensorListState> {
|
||||
|
||||
private data: any;
|
||||
|
||||
constructor(props: Props, context: State) {
|
||||
constructor(props: SensorListProps, context: SensorListState) {
|
||||
super(props, context);
|
||||
// this.state = {
|
||||
// selected: null,
|
||||
// isDetail: false, // temp
|
||||
// };
|
||||
this.state = {
|
||||
selected: null,
|
||||
isDetail: false, // temp
|
||||
};
|
||||
}
|
||||
|
||||
public componentWillMount(): void {
|
||||
super.componentWillMount();
|
||||
// super.componentWillMount();
|
||||
this.data = [
|
||||
{
|
||||
'id': '111',
|
||||
|
@ -116,7 +116,7 @@ export class SensorList extends React.Component<Props, State> {
|
|||
|
||||
public render(): JSX.Element {
|
||||
if (this.state.isDetail) {
|
||||
return <SensorDetail sensor={this.state.selected} />;
|
||||
return (<SensorDetail sensor={this.state.selected} />);
|
||||
}
|
||||
return (
|
||||
<Container fluid>
|
||||
|
@ -152,10 +152,6 @@ export class SensorList extends React.Component<Props, State> {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
private onReadAllByTarget(): void {
|
||||
console.log('');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user