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

support decorators #43

Open
chenjigeng opened this issue May 3, 2019 · 3 comments
Open

support decorators #43

chenjigeng opened this issue May 3, 2019 · 3 comments

Comments

@chenjigeng
Copy link

Are you submitting a bug report or a feature request?

feature request

What is the expected behavior?

just like react-final-form.

@Freddy03h
Copy link

Freddy03h commented May 17, 2019

You can by doing this:

const { form } = useForm({ onSubmit });

calculator(form);

@Freddy03h
Copy link

Freddy03h commented May 17, 2019

Or, regarding https://github.com/final-form/react-final-form/blob/v5.1.0/src/ReactFinalForm.js#L94, maybe more something like that:

useEffect(() => {
  const unsubscribe = calculator(form);
  return () => unsubscribe();
});

and perhaps we can use this useEffect only on mount

useEffect(() => {
  const unsubscribe = calculator(form);
  return () => unsubscribe();
}, []);

@Freddy03h
Copy link

or maybe form

useEffect(() => {
  const unsubscribe = calculator(form);
  return () => unsubscribe();
}, [form]);

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

No branches or pull requests

2 participants