FormFlow vs Formik
Modern hooks API vs render props, plus built-in backend submission.
Key Differences
1. API Style: Formik uses render props and component-based API. FormFlow uses modern React hooks.
2. Backend: Formik is frontend-only. FormFlow includes backend submission out of the box.
3. Performance: FormFlow is built on react-hook-form, which is faster and has smaller bundle size.
Code Comparison
Formik (Render Props)
import { Formik, Field, Form } from 'formik';
function ContactForm() {
return (
<Formik
initialValues={{ email: '', name: '' }}
onSubmit={async (values) => {
// You write the API call
await fetch('/api/contact', {
method: 'POST',
body: JSON.stringify(values),
});
}}
>
<Form>
<Field name="email" type="email" />
<Field name="name" />
<button type="submit">Submit</button>
</Form>
</Formik>
);
}
// Still need:
// ❌ Backend API route
// ❌ Database
// ❌ Email notificationsFormFlow (Hooks)
import { useFormFlow } from '@formflow.sh/react';
import { Input } from '@/components/ui/input';
function ContactForm() {
const { register, handleSubmit } = useFormFlow({
apiKey: process.env.NEXT_PUBLIC_FORMFLOW_API_KEY,
onSuccess: () => alert('Sent!'),
});
return (
<form onSubmit={handleSubmit}>
<Input {...register('email')} type="email" />
<Input {...register('name')} />
<button type="submit">Submit</button>
</form>
);
}
// Backend included:
// ✅ API, storage, emails all automaticFeature Comparison
| Feature | FormFlow | Formik |
|---|---|---|
| Modern hooks API | ✓ | ✗ (render props) |
| Works with UI libraries | ✓ | Limited |
| TypeScript support | ✓ | ✓ |
| Client-side validation | ✓ | ✓ |
| Bundle size | Small (~24kb) | Larger (40kb) |
| Performance | Faster | Slower |
| Backend submission | ✓ | ✗ |
| Data storage | ✓ | ✗ |
| Email notifications | ✓ | ✗ |
| Dashboard & analytics | ✓ | ✗ |
API Style Comparison
Formik (Render Props)
<Formik
initialValues={{...}}
onSubmit={(values) => {...}}
>
{({ handleSubmit, values }) => (
<Form>
<Field name="email" />
</Form>
)}
</Formik>Render props pattern requires nesting and callback functions
FormFlow (Hooks)
const { register, handleSubmit } =
useFormFlow({
apiKey: 'xxx',
onSuccess: () => {...}
});
<form onSubmit={handleSubmit}>
<input {...register('email')} />
</form>Modern hooks pattern is cleaner and more intuitive
Performance
~24kb
FormFlow bundle size
40kb
Formik bundle size
60%
Smaller bundle
FormFlow is built on react-hook-form, which is optimized for performance with fewer re-renders
Use Formik when:
- ✓ You're already using it (migration cost)
- ✓ You prefer render props pattern
- ✓ You have custom backend logic
- ✓ You need Formik-specific plugins
Use FormFlow when:
- ✓ You want modern hooks API
- ✓ You need better performance
- ✓ You don't want to write backend code
- ✓ You want built-in storage and notifications
Migrating from Formik
Switching from Formik to FormFlow is straightforward:
Before (Formik)
<Formik
initialValues={{ email: '' }}
onSubmit={(values) => {
fetch('/api/submit', {
method: 'POST',
body: JSON.stringify(values)
});
}}
>
<Form>
<Field name="email" />
<button type="submit">
Submit
</button>
</Form>
</Formik>After (FormFlow)
const { register, handleSubmit } =
useFormFlow({
apiKey: 'xxx',
onSuccess: () => alert('Sent!')
});
<form onSubmit={handleSubmit}>
<input {...register('email')} />
<button type="submit">
Submit
</button>
</form>