UNPKG

506 BJavaScriptView Raw
1/** @jsx h */
2import { Component, h } from 'preact';
3
4export const transitionIn = Wrapped => {
5 class TransitionIn extends Component {
6 constructor(props) {
7 super(props);
8 this.state = {
9 firstRender: true
10 };
11 }
12
13 componentDidMount() {
14 setTimeout(() => {
15 this.setState({ firstRender: false });
16 }, 0);
17 }
18
19 render() {
20 return h(Wrapped, Object.assign({ firstRender: this.state.firstRender }, this.props));
21 }
22 }
23
24 return TransitionIn;
25};
\No newline at end of file