mirror of
https://github.com/c8r/x0.git
synced 2024-10-26 15:15:04 +03:00
32 lines
647 B
JavaScript
32 lines
647 B
JavaScript
import React from 'react'
|
|
import { Link } from 'react-router-dom'
|
|
|
|
export default class extends React.Component {
|
|
static getInitialProps = async () => {
|
|
return {
|
|
asyncProps: 'hello'
|
|
}
|
|
}
|
|
|
|
render () {
|
|
const {
|
|
count,
|
|
update
|
|
} = this.props
|
|
|
|
return (
|
|
<div>
|
|
<Link to='/'>Home</Link>
|
|
<Link to='/about'>About</Link>
|
|
<h1>Hello x0</h1>
|
|
<samp>{count}</samp>
|
|
<button onClick={e => update(dec)}>-</button>
|
|
<button onClick={e => update(inc)}>+</button>
|
|
</div>
|
|
)
|
|
}
|
|
}
|
|
|
|
const dec = s => ({ count: s.count - 1 })
|
|
const inc = s => ({ count: s.count + 1 })
|