final-form / react-final-form-hooks

React Hooks to bind to 🏁 Final Form's high performance subscription-based form state management engine
MIT License
471 stars 19 forks source link

Uncaught TypeError: form.setConfig is not a function #29

Open developerpoidi opened 5 years ago

developerpoidi commented 5 years ago

Version: react-final-form-hooks@1.0.0

I'm not able to use the latest release 1.0.0. I get following excpetion: "Uncaught TypeError: form.setConfig is not a function" Here is a simple example: https://codesandbox.io/s/n03r1q8omm

When I look at the source, the problem is, that you access the "form" object instead of "form.current" or "getForm()".

brunodesde1987 commented 5 years ago

Here worked with this version: "react-final-form-hooks": "1.0.0-alpha.1"

durre commented 5 years ago

Yep, same here. You can get around it by defining the submit function outside the component like this:

const handleSubmit = (values) => console.log(values)

const App = () => {
  const { form } = useForm({
    onSubmit: handleSubmit
  });
  return <div>Not needed</div>;
};

But in my case I need access to the props in the component. Not sure what's going on.

zhuangya commented 5 years ago

ref #25

zhuangya commented 5 years ago

since #25 has been merged and released

should this issue be closed?