mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
20 lines
326 B
JavaScript
20 lines
326 B
JavaScript
|
import React from 'react'
|
||
|
|
||
|
export default class Welcome extends React.Component {
|
||
|
state = { name: null }
|
||
|
|
||
|
componentDidMount () {
|
||
|
const { name } = this.props
|
||
|
this.setState({ name })
|
||
|
}
|
||
|
|
||
|
render () {
|
||
|
const { name } = this.state
|
||
|
if (!name) return null
|
||
|
|
||
|
return (
|
||
|
<p>Welcome, {name}</p>
|
||
|
)
|
||
|
}
|
||
|
}
|