react-final-form-hooks icon indicating copy to clipboard operation
react-final-form-hooks copied to clipboard

Uncaught TypeError: form.setConfig is not a function

Open developerpoidi opened this issue 6 years ago • 4 comments

Version: [email protected]

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()".

developerpoidi avatar Feb 12 '19 07:02 developerpoidi

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

brunodesde1987 avatar Feb 20 '19 20:02 brunodesde1987

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.

durre avatar Mar 01 '19 09:03 durre

ref #25

zhuangya avatar Mar 04 '19 09:03 zhuangya

since #25 has been merged and released

should this issue be closed?

zhuangya avatar Mar 07 '19 09:03 zhuangya