Saturday, 26 May 2018

getFieldValue or similar in Formik

Is there a way to get the value of a field inside a click handler in formik?

You can use setFieldValue in there, so I'd assume (but can't find anywhere) that Formik should have something like that for retrieving values:

<Button onClick={() => getFieldValue('name') === 'Test' ? action1 : action2}

What is the correct way to do this in Formik?



from getFieldValue or similar in Formik

No comments:

Post a Comment