Socket
Socket
Sign inDemoInstall

effector-react

Package Overview
Dependencies
5
Maintainers
6
Versions
142
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    effector-react

React bindings for effector


Version published
Weekly downloads
36K
increased by27.24%
Maintainers
6
Install size
360 kB
Created
Weekly downloads
 

Changelog

Source

effector-react 23.2.0

  • Make Gate.open and Gate.close EventCallable to allow users to call it in tests

Readme

Source

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

Keywords

FAQs

Last updated on 07 Feb 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc