This file contains hidden or 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
| import store from '../MyStoreAndMore.js' | |
| class SecondScreen extends React.Component { | |
| constructor(props, context) { | |
| super(props, context); | |
| this.state = store.getState(); | |
| store.subscribe(()=>{ | |
| this.setState(store.getState()); |
This file contains hidden or 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
| import store from '../MyStoreAndMore.js' | |
| SetAlertState=(mynumber)=>{ | |
| console.log('set alert state') | |
| store.dispatch({ | |
| type: "SetAlertCount", | |
| payload: { AlertCount: mynumber, } | |
| }); |
This file contains hidden or 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
| import { createStore} from 'redux' | |
| const defaultState = { | |
| AlertCount: null | |
| }; | |
| function chatStore(state=defaultState, action) { | |
| switch(action.type) { | |
| case "SetAlertCount": | |
| return {...state, | |
| AlertCount: action.payload.AlertCount |