@whitetrefoil/unistore-act
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

@whitetrefoil/unistore-act

WARNING: THIS APPLICATION IS STILL DEVELOPING!!!

Act a action directly from DOM events for unistore.

Why This?

Usually we call an action like: myAction(payload). While the payload often is ev.target.value. So here is a shortcut.

Usage

act(myAction)
// equals
(ev: Event) => myAction(ev.target.value)

// Here's also a `currentTarget` version:
cact(myAction)
// equals
(ev: Event) => myAction(ev.currentTarget.value)
import { act } from '@whitetrefoil/unistore-act'

const myAction = // some action

class MyComp {
  // ...
  render() {
    return (
      <div><button onClick={act(myAction)}>Click Me!</button></div>
    )
  }
  // ...
}

Changelog

v0.2.0

  • Change API in order to be compatible with @whitetrefoil/unistore-bind@v0.2.0.

v0.1.0

  • Initial release.

Readme

Keywords

Package Sidebar

Install

npm i @whitetrefoil/unistore-act

Weekly Downloads

0

Version

0.2.0

License

MIT

Unpacked Size

16 kB

Total Files

11

Last publish

Collaborators

  • whitetrefoil