import { useForm } from '@inertiajs/react' export default function Form({ <%= singular_table_name %>, onSubmit, submitText }) { const form = useForm({ <% attributes.each do |attribute| -%> <% if attribute.password_digest? -%> password: '', password_confirmation: '', <% else -%> <%= attribute.column_name %>: <%= singular_table_name %>.<%= attribute.column_name %> || <%= default_value(attribute) %>, <% end -%> <% end -%> }) const { data, setData, errors, processing } = form const handleSubmit = (e) => { e.preventDefault() onSubmit(form) } return (
) }