Skip to content

Instantly share code, notes, and snippets.

@fabe
Last active August 9, 2018 13:44
Show Gist options
  • Save fabe/f24edbdaeed0473cfab6294c291b79c3 to your computer and use it in GitHub Desktop.
Save fabe/f24edbdaeed0473cfab6294c291b79c3 to your computer and use it in GitHub Desktop.
import React from 'react';
import { CSSTransition, TransitionGroup } from 'react-transition-group';
export const replaceComponentRenderer = ({ props }) => {
const children = React.createElement(props.pageResources.component, props);
return (
<div>
<TransitionGroup>
<CSSTransition key={props['*']} timeout={200} classNames="fade">
<div
style={{
position: 'absolute',
width: '100%',
backgroundColor: '#fff',
}}
>
{children}
</div>
</CSSTransition>
</TransitionGroup>
</div>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment