@act/optimistic

0.0.2 • Public • Published

Act
A simple reactive front-end framework

 


Act optimistic updates

Act optimistic updates hello world:

import main from '@act/optimistic'
import map from 'ramda/src/map'
import valueOnEnter from '@act/main/processes/valueOnEnter'

const add = (payload, history) =>
  history.push({ type: 'success', payload }, (rollback) =>
    setTimeout(rollback, 5000))

const view = (comments) =>
  ['main', [
    ['input', { keyup: [add, valueOnEnter], value: '' }],
    ...map((comment) => ['div', comment], comments)
  ]]

const reducer = (state = [], { type, payload }) =>
  type === 'success' ? [...state, payload] : state

main(view, { reducer })

More

The documentation for this module is part of Act's docs.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.2
    3
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.2
    3
  • 0.0.1
    2

Package Sidebar

Install

npm i @act/optimistic

Weekly Downloads

4

Version

0.0.2

License

ISC

Last publish

Collaborators

  • act