Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

single-source.subscribe(path, callback)

node v8.17.0
version: 1.0.0
endpointsharetweet
const createStore = require('single-source').createStore; const CURRENT_LANG = 'currentLanguage'; const initialState = { items: [], currentLanguage: 'en', }; const myStore = createStore(initialState); myStore.subscribe(CURRENT_LANG, (newLanguage) => { console.log('the new Language is: ', newLanguage); }) myStore.dispatch({ path: CURRENT_LANG, payload: 'fr', });
Loading…

no comments

    sign in to comment