constructor(props) { super(props); store.subscribe(this.onStoreUpdate.bind(this)); store.dispatch(appActions.appInitialized()); }
configureStore().then((store) => { store.subscribe( throttle(() => { const state = store.getState(); saveState(state); }, 800) ); render(<Root store={store} />, document.getElementById("root")); });
storiesOf('The App', module) .add(' ', () => { let store = createStore(reducers, loadState()) store.subscribe(() => { saveState(store.getState()) }) return ( <Provider store={store}> <App /> </Provider> ) })
store.subscribe(() => { const state = store.getState(); const visibleExpenses = getVisibleExpenses(state.expenses, state.filters); console.log(visibleExpenses); });
componentWillMount() { this.onChange = this.onChange.bind(this); store.subscribe(this.onSettingsChange.bind(this)); this.onSettingsChange(); }
store.subscribe(throttle(() => { saveState({ user: store.getState().user, checks: store.getState().checks, globalStats: store.getState().globalStats, log: store.getState().log, reports: store.getState().reports, }); }, 1000));
componentWillMount() { store.subscribe(this.change.bind(this)); this.onChange = this.onChange.bind(this); this.onTabChange = this.onTabChange.bind(this); this.onSubmit = this.onSubmit.bind(this); this.onLibrarySave = this.onLibrarySave.bind(this); this.onLibraryClose = this.onLibraryClose.bind(this); this.change(); }
// subscribes to an update store.subscribe( () => { console.log(store.getState()) render() })
componentWillMount() { // You can use subscribe() to update the UI in response to state changes. // Normally you'd use a view binding library (e.g. React Redux) rather than subscribe() directly. // However it can also be handy to persist the current state in the localStorage. this.unsubscribe = store.subscribe(() => { const value = store.getState(); console.log(value); this.setState({ value }); }); }
componentDidMount () { this.unsubscribe = store.subscribe(() => this.forceUpdate() ) }
constructor() { store.subscribe(() => { this.setState({ counters: store.getState() }); }); // Get default state this.setState({ counters: store.getState() }); }
store.subscribe(() => { var state = store.getState(); console.log("State changed"); console.log(state); })
store.subscribe(() => { console.log(store); /*if (store.getState().users.userSignedUp) browserHistory.push('/posts');*/ } );
store.subscribe( ()=>{ console.log(store.getState()); } );
store.subscribe( () => { console.log("subscriber 1", store.getState()); } );