Skip to content

Instantly share code, notes, and snippets.

@christianalfoni
Created August 26, 2015 18:27
Show Gist options
  • Save christianalfoni/3d3631eb03366ab71353 to your computer and use it in GitHub Desktop.
Save christianalfoni/3d3631eb03366ab71353 to your computer and use it in GitHub Desktop.
transition group problems
import React from 'react';
import {Decorator as Cerebral} from 'cerebral-react';
import {CSSTransitionGroup} from 'react-addons';
import Home from './Home.js';
import Admin from './Admin.js';
@Cerebral({
title: ['title'],
currentPage: ['currentPage']
})
class App extends React.Component {
renderPage() {
switch (this.props.currentPage) {
case 'home':
return <Home key="home"/>;
case 'admin':
return <Admin key="admin"/>;
}
}
render() {
return (
<div>
<a href="/">Home</a> - <a href="/admin">Admin</a>
<h1>{this.props.title}</h1>
<CSSTransitionGroup transitionName="example">
{this.renderPage()}
</CSSTransitionGroup>
</div>
);
}
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment