meiosis-setup Documentation

Initial State ⬆ Contents Services

View Library

Once Meiosis is set up either with Function Patches or Mergerino, you have a stream of cells. Each cell has state and update to read the state and update the state. Normally you use cells.map to render the view on each state change.

Mithril

Here is the setup code for Mithril:

In the setup above, m.redraw() is called for every state change. This may or may not be acceptable depending in the application. If the application triggers many state changes very rapidly (such as tracking the mouse), it is preferable to remove the m.redraw() code:

cells.map(() => m.redraw());

Redraws will still happen by virtue of Mithril's auto-redraw system. However, they will not happen for state changes outside of the auto-redraw system. For those state changes, m.redraw() needs to be called after updating the state.

Preact:

Here is the setup code for Preact:

React:

Here is the setup code for React:

Initial State ⬆ Contents Services

Meiosis is developed by foxdonut (Twitter / GitHub) and is released under the MIT license.