i'm trying to create animation when component mount/unmount with React-spring:
import { Transition, animated } from 'react-spring'
...
export class CompName extends PureComponent<CompNamePropsType> {
static defaultProps = {
isExpanded: false,
}
render() {
const {
isExpanded,
...props
} = this.props
return (
<section className={styles.block} {...props}>
<Transition
from={{ opacity: 0 }}
enter={{ opacity: 1 }}
leave={{ opacity: 0 }}>
{isExpanded && (style => (
<animated.div style={{ ...style, background: "orange" }}>
<AnotherComp />
</animated.div>
))}
</Transition>
</section>
)
}
}
But this is just does not work and i got an error children is not a function
. What i did wrong, and how can i create animation on component mount/unmount with react-spring wrapper?