Created
May 11, 2018 15:58
-
-
Save rrfaria/bca49fe17190adb2fe78833b89417ee0 to your computer and use it in GitHub Desktop.
React redux and Transition Group
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { Provider } from 'react-redux'; | |
import { | |
BrowserRouter as Router, | |
Switch, | |
Route, | |
Link, | |
Redirect | |
} from 'react-router-dom'; | |
import { ConnectedRouter } from 'react-router-redux'; | |
import { | |
TranstionGroup, | |
CSSTransition, | |
} from 'react-transition-group'; | |
import Header from './components/layout/header'; | |
import Search from './components/search'; | |
import searchList from './components/searchList'; | |
import './App.css'; | |
import store, { history } from './stores'; | |
class App extends Component { | |
render() { | |
return ( | |
<Provider store={store}> | |
<ConnectedRouter history={history}> | |
<Route render={({ location }) => ( | |
<div className="App"> | |
<Header/> | |
<main className="App-container"> | |
<Link to="/">Home</Link> | |
<Link to="/searchlist">SearchList</Link> | |
<TranstionGroup> | |
<CSSTransition | |
key={location.key} | |
timeout={300} | |
classNames='searching' | |
> | |
<Switch location={location}> | |
<Route exact path="/" component={Search} /> | |
<Route exact path="/searchlist" component={searchList} /> | |
</Switch> | |
</CSSTransition> | |
</TranstionGroup> | |
</main> | |
</div> | |
)} /> | |
</ConnectedRouter> | |
</Provider> | |
); | |
} | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment