alveron package which was once called react-woodworm.
Depreacted! This is the old alveron package which has been deprecated in favor of a newer version without Redux. Check out the newalveron
Alveron is a highly opinionated state architecture for React using Redux.
It is heavily inspired by The Elm Architecture and aims to simplify component-based state management.
Installation
Alveron requires
react-redux
to be installed in your project. Therefore,react
must also be installed.
yarn add alveron react react-redux
Benefits
- locally-scoped state
- plays well with third-party reducer
- single file for markup & application state
- simple & compact interface
The Gist
import { createContainer } from 'alveron'
// the initial state
const model = 0
// the reducer functions
const update = {
increase: state => state + 1,
decrease: state => state - 1
}
// a functional component which gets both the state
// and the action dispatcher passed via props
const view = ({ state, increase, decrease }) => (
<div>
<span>Counter: {state}</span>
<button onClick={increase}>Increase</button>
<button onClick={decrease}>Decrease</button>
</div>
)
// the single higher-order function that links
// everything together and returns a React component
const Counter = createContainer({
view,
update,
model
})()
// usage
<Counter />
Documentation
Examples
License
Alveron is licensed under the MIT License.
Documentation is licensed under Creative Common License.
Created with