Created
March 27, 2017 04:38
-
-
Save cellog/0731f7e1ba8f9009f6b208c2bd15aa16 to your computer and use it in GitHub Desktop.
react-redux-saga-router solution
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 Router from 'react-redux-saga-router/Router' | |
import Route from 'react-redux-saga-router/Route' | |
import * as actions from './actions' | |
const updateState = { | |
article: article => actions.setCheckoutStateToBuying(article) | |
} | |
export const Routes = () => ( | |
<Routes> | |
<Route name="welcome" path="/welcome" /> | |
<Route name="purchase" path="/buy/:article" | |
updateState={updateState} | |
/> | |
</Routes> | |
) |
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 Toggle from 'react-redux-saga-router/Toggle' | |
const PurchaseToggle = Toggle(state => state.checkoutState.status === TRYING_TO_BUY) | |
class WelcomeScreen extends Component { | |
render() { | |
return ( | |
<div> | |
<PurchaseToggle component={ArticlePurchaseBlock} articleId={id} else={Welcome} /> | |
</div> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment