Plugins can trigger own actions with core reducers

This commit is contained in:
Belen Curcio
2017-03-30 12:24:19 -03:00
parent 17a8f48b4f
commit 679962168c
8 changed files with 42 additions and 16 deletions
@@ -1 +1,6 @@
export const clickButton = () => ({type: 'BUTTON_CLICKED'});
const buttonClicked = () => ({type: 'BUTTON_CLICKED'});
export const clickButton = () => dispatch => {
console.log('here');
dispatch(buttonClicked());
};
+1 -2
View File
@@ -3,8 +3,7 @@ import styles from './style.css';
export default (props) => (
<div className={styles.Respect} key={props.key}>
{console.log(props)}
<button>Respect</button>
<button onClick={props.pluginProps.clickButton}>Respect</button>
</div>
);
@@ -6,6 +6,9 @@ const initialState = Map({
export function respect (state = initialState, action) {
switch (action.type) {
case 'BUTTON_CLICKED' :
return state
.set('clicked', !state.get('clicked'));
default:
return state;
}