Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support of object/array of events for useEvent #425

Merged
merged 4 commits into from
Nov 22, 2020

Conversation

sergeysova
Copy link
Collaborator

@sergeysova sergeysova commented Nov 21, 2020

import React from "react";
import { useEvent } from "effector-react/ssr";

import { emailChanged, passwordChanged } from "./model";

export function ExampleComponent() {
  const handlers = useEvent({ emailChanged, passwordChanged });

  return (
    <div>
      <input onChange={handlers.emailChanged} />
      <input onChange={handlers.passwordChanged} />
    </div>
  );
}

import React from "react";
import { useEvent } from "effector-react/ssr";

import { emailChanged, passwordChanged } from "./model";

export function ExampleComponent() {
  const [email, password] = useEvent([emailChanged, passwordChanged]);

  return (
    <div>
      <input onChange={email} />
      <input onChange={password} />
    </div>
  );
}

@sergeysova sergeysova changed the title add support of object of events for useEvent add support of object/array of events for useEvent Nov 22, 2020
@sergeysova sergeysova changed the title add support of object/array of events for useEvent add support of object/array of events for useEvent Nov 22, 2020
@zerobias
Copy link
Member

Great idea, thanks 👍👍

@zerobias zerobias merged commit ec79d9d into master Nov 22, 2020
@zerobias zerobias deleted the feat/add-object-of-events-for-useEvent branch November 22, 2020 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants