import React, { Component } from 'react';
import { Formik, Form, Field } from 'formik'
class MyFormik extends Component {
render() {
return (
<div>
<div className="container">
<div className="row">
<div className="col-6 offset-3 card">
<h4 className='card-header'>This is formik</h4>
<Formik
initialValues={{
name: 'fdg',
email: '',
password: ''
}}
onSubmit={(values, formikBag) => {
console.log(values);
console.log(formikBag);
}}
>
{(props) => {
// console.log(props)
return (
<form onSubmit={props.handleSubmit}>
<input
type="text"
name='name'
placeholder='Enter Name'
value={props.values.name}
onChange={props.handleChange}
/>
<br/>
<input
type="email"
name='email'
placeholder='Enter Email'
value={props.values.email}
onChange={props.handleChange}
/>
<br/>
<input
type="password"
name='password'
placeholder='Enter Password'
value={props.values.password}
onChange={props.handleChange}
/>
<br/>
<button type='submit'>Submit</button>
</form>
)
}}
</Formik>
</div>
</div>
</div>
</div>
);
}
}
export default MyFormik;