import { TransitionGroup, CSSTransition } from 'react-transition-group';
import './style.less';

export default (props) => {
  const { location } = props;
  const currentURL = location.pathname + location.search;

  return (
    <TransitionGroup component={null}>
      <CSSTransition
        key={currentURL}
        addEndListener={(node, done) => node.addEventListener("transitionend", done, false)}
        classNames="page-fade"
      >
        <div>
          {props.children}
        </div>
      </CSSTransition>
    </TransitionGroup>
  );
}
