import RxStore from '@zazapeta/rx-react-store';
const initialState = {
title: 'Super App',
version: 1,
};
const ns = 'App';
let appStore = new RxStore({ ns, initialState });
appStore.AfterGlobalParalel.set('InfoLogger', (state, action) =>
console.info(`[${action.name}] STATE:`, state),
);
export default appStore;
import appStore from './app.store.js';
function setTitle(state, title){
return {...state, title}
}
function App({title}){
return (
<div>
<h1>{title}</h1>
<input
type='text'
onChange={(e) => appStore.dispatch(setTitle, e.target.value)}
/>
</div>
);
}
export default appStore.connect()(App);