UNPKG

473 BJavaScriptView Raw
1import { Component, h } from 'preact'
2
3export default (Wrapped) => {
4 class TransitionIn extends Component {
5 constructor (props) {
6 super(props)
7 this.state = {
8 firstRender: true
9 }
10 }
11
12 componentDidMount () {
13 setTimeout(() => {
14 this.setState({firstRender: false})
15 }, 0)
16 }
17
18 render () {
19 return h(Wrapped, Object.assign({firstRender: this.state.firstRender}, this.props))
20 }
21 }
22
23 return TransitionIn
24}