inertia-rails-forms
Installation
SKILL.md
Inertia Rails Forms
Full-stack form handling for Inertia.js + Rails.
Before building a form, ask:
- Simple create/edit? →
<Form>component (no state management needed) - Requires per-field UI elements? → Still
<Form>. ReactuseStatefor UI state (preview URL, file size display) is independent of form data —<Form>handles the submission;useStatehandles the UI. - Multi-step wizard, dynamic fields (add/remove inputs), or form data
shared with sibling components (e.g., live preview panel)? →
useFormhook - Tempted by react-hook-form? → Don't. Inertia's
<Form>already handles CSRF tokens, redirect following, error mapping from Rails, processing state, file upload detection, and history state. react-hook-form would duplicate or fight all of this.
When NOT to use <Form> or useForm:
- Data lookups — not a form submission. Use
router.getwith debounce +preserveState, or rawfetchfor large datasets - Inline single-field edits without navigation –
router.patchdirectly, oruseFormif you need error display on the field
Related skills