-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Global action #59
Comments
Yes of course, just connect For your example, here is a possible solution: import mirror, { actions } from 'mirrorx'
mirror.model({
name: 'mediaQuery',
initialState: {
width: 0,
height: 0
},
reducers: {
change(state, data) {
return { ...state, ...data }
}
}
})
// in your media query change event
actions.mediaQuery.change({ width, height })
// components that need to update when media query change
import Comp from './components/Comp'
const MyComponent = connect(state => {
return {
mediaQuery: state.mediaQuery,
stateOfComp: state.stateOfComp
}
})(Comp) |
Your suggestion is what I doing right now |
You can. Try the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is it possible to have an event that can be listened by multiple models 😄
For example, I have a listener that fire action every time screen media query changed. This action needs to be listened by multiple ui state models
The text was updated successfully, but these errors were encountered: