2017-11-23 12:41:59 +00:00
|
|
|
import React from 'react'
|
|
|
|
import Link from 'next/link'
|
|
|
|
import { inject, observer } from 'mobx-react'
|
|
|
|
import Clock from './Clock'
|
|
|
|
|
2018-10-14 08:04:58 +00:00
|
|
|
@inject('store')
|
|
|
|
@observer
|
|
|
|
class SampleComponent extends React.Component {
|
2017-12-04 23:19:53 +00:00
|
|
|
componentDidMount () {
|
2017-11-23 12:41:59 +00:00
|
|
|
this.props.store.start()
|
|
|
|
}
|
|
|
|
|
2017-12-04 23:19:53 +00:00
|
|
|
componentWillUnmount () {
|
2017-11-23 12:41:59 +00:00
|
|
|
this.props.store.stop()
|
|
|
|
}
|
|
|
|
|
2017-12-04 23:19:53 +00:00
|
|
|
render () {
|
2017-11-23 12:41:59 +00:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<h1>{this.props.title}</h1>
|
|
|
|
<Clock lastUpdate={this.props.store.lastUpdate} light={this.props.store.light} />
|
|
|
|
<nav>
|
|
|
|
<Link href={this.props.linkTo}><a>Navigate</a></Link>
|
|
|
|
</nav>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-14 08:04:58 +00:00
|
|
|
export default SampleComponent
|