Skip to content

Instantly share code, notes, and snippets.

@cellog
Created March 27, 2017 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cellog/0731f7e1ba8f9009f6b208c2bd15aa16 to your computer and use it in GitHub Desktop.
Save cellog/0731f7e1ba8f9009f6b208c2bd15aa16 to your computer and use it in GitHub Desktop.
react-redux-saga-router solution
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>
)
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