Last active
December 9, 2015 15:10
-
-
Save kvasdopil/66be0d29ac44ca79eb83 to your computer and use it in GitHub Desktop.
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
// == actions.js == | |
function showModal(id, cb) | |
{ | |
return {type: 'SHOW_MODAL', id, cb: (ok) => { | |
closeModal(id); // dispatch here? | |
if(ok) cb(); | |
}}; | |
} | |
function closeModal(id) | |
{ | |
return {type: 'CLOSE_MODAL', id} | |
} | |
// == myModule.js == | |
@Connected | |
class MyModule | |
{ | |
onClickButton() { | |
this.props.actions.showModal('myModal', () => { | |
console.log('window is closed'); | |
}); | |
} | |
render() | |
{ | |
return <Modal {...this.props.store.modals.myModal} >...</Modal> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment