Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created June 10, 2020 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velotiotech/2fa95ac005cc891fde0f132c7cf033c8 to your computer and use it in GitHub Desktop.
Save velotiotech/2fa95ac005cc891fde0f132c7cf033c8 to your computer and use it in GitHub Desktop.
import React from 'react';
import { useFormik } from 'formik';
import response from "./apiresponse"
import RecursiveContainer from './RecursiveContainer';
import * as yup from 'yup';
const SignupForm = () => {
const signupSchema = yup.object().shape({
name: yup.string().required()
});
const formik = useFormik({
initialValues: {
},
onSubmit: values => {
alert(JSON.stringify(values, null, 2));
},
validationSchema: signupSchema
});
console.log(formik, response)
return (
<form onSubmit={formik.handleSubmit}>
<RecursiveContainer config={response} formik={formik} />
<button type="submit" disabled={!formik.isValid}>Submit</button>
</form>
);
};
export default SignupForm;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment