0.5.0 • Published 2 years ago
effe-ts v0.5.0
effe-ts
Fork of elm-ts. Effe is the german word for elm.
Install
yarn add effe-ts
Usage
Counter example
import * as React from 'react'
import * as ReactDOM from 'react-dom'
import { html, state } from 'effe-ts'
type Action = { type: 'Increase' } | { type: 'Decrease' }
type Model = number
interface State extends state.State<{}, Model> {}
const init: State = state.of(0)
const update = (action: Action) => (model: Model): State => {
switch (action.type) {
case 'Increase':
return state.of(model + 1)
case 'Decrease':
return state.of(model - 1)
}
}
function view(model: Model): html.Html<JSX.Element, Action> {
return dispatch => (
<>
<span>Counter: {model}</span>
<button onClick={() => dispatch({ type: 'Increase' })}>+</button>
<button onClick={() => dispatch({ type: 'Decrease' })}>-</button>
</>
)
}
const app = html.program(init, update, view)
html.run(app, dom => ReactDOM.render(dom, document.getElementById('app')!), {})
Further examples
- effe-ts-starter - Starter Project that conatins Routing and Bootstrap.
- react-todo-app - Example TODO application with live sync between multiple browser instances via CouchDB
- Http Request Example
0.5.0-beta.1
2 years ago
0.5.0-beta.4
2 years ago
0.5.0-beta.3
2 years ago
0.5.0-beta.2
2 years ago
0.5.0
2 years ago
0.4.1
4 years ago
0.4.0
4 years ago
0.3.0
4 years ago
0.2.8
4 years ago
0.2.7
4 years ago
0.2.6
4 years ago
0.2.5
4 years ago
0.2.4
4 years ago
0.2.3
4 years ago
0.2.2
5 years ago
0.2.1
5 years ago
0.2.0
5 years ago
0.1.0
5 years ago
0.0.14
5 years ago
0.0.13
5 years ago
0.0.12
5 years ago
0.0.11
5 years ago
0.0.10
5 years ago
0.0.9
5 years ago
0.0.8
5 years ago
0.0.7
5 years ago
0.0.6
5 years ago
0.0.5
5 years ago
0.0.4
5 years ago
0.0.3
5 years ago
0.0.2
5 years ago
0.0.1
5 years ago