Redux implementation using Elm for state and updates
npm install @aardito2/realmshell
npm install @aardito2/realm
`
#### createStore(elmStore, initialState = {}, enhancer)
`javascript
// using elm-webpack-loader
import elmStore from './store.elm';
const initialState = {};
const store = createStore(elmStore.Store, initialState);
`
#### applyMiddleware
See Redux docs.
#### createAction(actionType) => payload => action
`javascript
const INCREMENT = 'increment';
const increment = createAction(INCREMENT);
const SET_STRING = 'set_string';
const setString = createAction(SET_STRING);
`
#### store.dispatch(action)
`javascript
dispatch(increment());
dispatch(setString('foo'));
`
$3
`shell
elm-package install @aardito2/realm
`
Your Elm file should be a Platform.programWithFlags. In main, your update should use Realm.updateState, which takes an outgoing port and an update function and returns a new update function which will automatically send your updated state back to JavaScript.
Your outgoing port will have the signature model -> Cmd msg`.