MyForm.js
import React from 'react';
import { withFormik } from 'formik';

//The component receives all these props from `withFormik`
const MyForm = ({
    values,
    touched,
    errors,
    handleChange,
    handleBlur,
    handleSubmit,
  }) => ...;

const MyEnhancedForm = withFormik({
  mapPropsToValues: () => ({ name: '' }),
  // Custom sync validation
  validate: values => {
    const errors = {};
    if (!values.name) {
      errors.name = 'Required';
    }
    return errors;
  },
  handleSubmit: values => {
    console.log('Will submit', values)
  }
})(MyForm);