DEV Community

artydev
artydev

Posted on

3 1

Meiosis in action

Another post on Meiosis pattern. If you want some details, feel free to comment.

/* @jsx m */

import m from "mithril";
import stream from "mithril-stream";
import merge from "mergerino";
import Actions from "../src/actions";
import View from "../src/view";

const InitialState = {
  counter: 0,
  angle: 0
};

const update = stream();
const states = stream.scan(merge, InitialState, update);
const actions = Actions(update);

const app = document.getElementById("app");

states.map(() => m.render(app, <h1>{View(states, actions)}</h1>));

/* Test */
setInterval(actions.testit, 0);

Fork it and spread it :-)
Edit codebarre

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay