1.2.0 • Published 7 years ago

tessellation v1.2.0

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

Library for Tessellation

npm install --save tessellation

createApp( reducer, initialState, effect )

renderEffect( ReactComponent, DomElement ): effect

import React from 'react'
import {createApp, renderEffect} from 'tessellation'

const reducer = (state, action) => {
  switch (action.type) {
    case 'ADD':
      return {
        ...state,
        value: state.value + 1
      }

    default:
      return reducer(state, action)
  }
}

const initialState = {value: 0}

const effects = [
  renderEffect(
    function View ({push, value}) {
      return <div>
        <span>{value}</span>
        <button onClick={() => push({type: 'ADD'})}>
          Add
        </button>
        <button onClick={() => push({type: 'REMOVE'})}>
          Remove
        </button>
      </div>
    },
    document.getElementById('root')
  ),

  () => (state) => console.log(state)
]

createApp(reducer, initialState, effects)
1.2.0

7 years ago

1.1.3

7 years ago

1.1.2

8 years ago

1.1.1

8 years ago

0.1.0

8 years ago