@ferp/react
v0.0.1-beta
Published
[](https://badge.fury.io/js/@ferp/react) [](https://travis-ci.org/ferp-js/ferp)  => (
<div className="counter">
<section className="counter-container">
<span className="counter-number">{state.count}</span>
<button className="counter-button" onClick={() => dispatch({ type: 'INCREMENT' })}>
+
</button>
<button className="counter-button" onClick={() => dispatch({ type: 'DECREMENT' })}>
-
</button>
</section>
</div>
));
const initialState = {
count: 0,
};
const update = (message, state) => {
switch (message.type) {
case 'INCREMENT':
return [{ ...state, count: state.count + 1 }, effects.none()];
case 'DECREMENT':
return [{ ...state, count: state.count - 1 }, effects.none()];
default:
return [state, effects.none()];
}
};
render(
<AppProvider
init={[initialState, effects.none()]}
update={update}
>
<Counter />
</AppProvider>,
document.body,
);More docs
Still have questions?
- Open an issue, we're happy to answer any of your questions, or investigate how to fix a bug.
- Join us on reddit, show off what you're doing, post tutorials, or just hang out, but keep things ferp related please.
- Chat with us on gitter, we'll try to be quick to respond.
