-
Notifications
You must be signed in to change notification settings - Fork 1
/
page-view.js
43 lines (39 loc) · 1.07 KB
/
page-view.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import React, { Component } from "react";
import { connect } from "react-redux";
import * as actions from "../../reducers/home/actions";
import { bindActionCreators } from "redux";
import "./home.scss";
import { Link } from "react-router-dom";
@connect(
state => {
return {
data: state.home
};
},
dispatch => {
return bindActionCreators(actions, dispatch);
}
)
export default class Home extends Component {
componentDidMount() {
this.counter = setInterval(() => {
let { increase } = this.props;
increase();
}, 1000);
}
componentWillUnmount() {
clearInterval(this.counter);
}
render() {
let { data } = this.props;
// if(data === 10) throw new Error('111')
return (
<div className="home-page">
<div>
<div> 你是否看到了时间的流失:{data} </div>
<Link to="/home/love">爱自己,爱这个世界</Link>
</div>
</div>
);
}
}