mirror of
https://github.com/wassname/talk.git
synced 2026-08-15 12:55:10 +08:00
Plugins can trigger own actions with core reducers
This commit is contained in:
@@ -1 +1,6 @@
|
||||
export const clickButton = () => ({type: 'BUTTON_CLICKED'});
|
||||
const buttonClicked = () => ({type: 'BUTTON_CLICKED'});
|
||||
|
||||
export const clickButton = () => dispatch => {
|
||||
console.log('here');
|
||||
dispatch(buttonClicked());
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user