I'm trying to figure out a JavaScript trick that will help make the following block more elegant:
switch(modal) {
case 'openLoginModal':
openLoginModal();
case 'openSignupModal':
openSignupModal();
...
}
This is ultimately for my React app that makes action calls to a Redux store in the following way:
switch(modal) {
case 'LoginModal':
this.props.actions.openLoginModal();
case 'SignupModal':
this.props.actions.openSignupModal();
...
}
Please let me know if you have any insight! Would strongly prefer avoiding the use of the global window.