effector-react
React bindings for effector
npm downloads npm version npm license
effector-reactSimilar Packages:
Npm Package Weekly Downloads Trend
3 Years
🌟 Show real-time usage chart on effector-react's README.md, just copy the code below.
## Usage Trend
[![Usage Trend of effector-react](https://npm-compare.com/img/npm-trend/THREE_YEARS/effector-react.png)](https://npm-compare.com/effector-react#timeRange=THREE_YEARS)
Cumulative GitHub Star Trend
🌟 Show GitHub stars trend chart on effector-react's README.md, just copy the code below.
## GitHub Stars Trend
[![GitHub Stars Trend of effector-react](https://npm-compare.com/img/github-trend/effector-react.png)](https://npm-compare.com/effector-react)
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
effector-react26,7834,778330 kB14710 months agoMIT
README for effector-react

effector-react

React bindings for effector

Installation

npm install --save effector effector-react

Or using yarn

yarn add effector effector-react

Usage

import {createStore, combine, createEvent} from 'effector'

import {useUnit} from 'effector-react'

const inputText = createEvent()

const $text = createStore('').on(inputText, (_, text) => text)

const $size = $text.map(text => text.length)

const Form = () => {
  const {text, size} = useUnit({
    text: $text,
    size: $size,
  })
  const handleTextChange = useUnit(inputText)

  return (
    <form>
      <input
        type="text"
        onChange={e => handleTextChange(e.currentTarget.value)}
        value={text}
      />
      <p>Length: {size}</p>
    </form>
  )
}

Try it

useUnit in docs Units in docs createStore in docs createEvent in docs