Redux-Leaves playground

node v10.24.1
version: 3.0.0
This is a playground to test JavaScript. It runs a completely standard copy of Node.js on a virtual server created just for you. Every one of npm’s 300,000+ packages are pre-installed, so try it out:
const { reduxLeaves } = require('redux-leaves') const { createStore } = require('redux') const initialState = { counter: 0, list: [] }
// No more reduce or action creator boilerplate: it's all done by Redux-Leaves const [reducer, actions] = reduxLeaves(initialState)
// Create your Redux store with the Redux-Leaves reducer const store = createStore(reducer)
// confirm initial state store.getState()
// let's increment counter store.dispatch(actions.counter.create.increment()) store.getState()
// push something to list store.dispatch(actions.list.create.push('something')) store.getState()
// set a new path to a value store.dispatch(actions.create.path(['arbitrarily', 'long', 'path'], true)) store.getState()
// let's get funky store.dispatch(, treeState) => [...leafState, treeState.arbitrarily.long.path])) store.getState()
// ...too much? let's reset store.dispatch(actions.create.reset()) store.getState()
// use this as a sandbox! // docs: store.dispatch(actions.readyForFun.create.on()) store.getState()

no comments

    sign in to comment