Enter/exit: Single component

PoseGroup can be used to animate enter and exit states of a single component when it’s added/removed to and from the component tree.

const Modal = posed.div({
  enter: { opacity: 1 },
  exit: { opacity: 0 }
});

export default ({ isVisible }) => (
  <PoseGroup>
    {isVisible ? <Menu /> : null}
  </PoseGroup>
)