Sha256: b7f07a8db8e0189cb86554201f61e9c92d66591444fcde61aab8c021af83eab8

Contents?: true

Size: 702 Bytes

Versions: 1

Compression:

Stored size: 702 Bytes

Contents

import { Head, Link } from '@inertiajs/react'
import Form from './Form'

export default function New({ <%= singular_table_name %> }) {
  return (
    <>
      <Head title="New <%= human_name.downcase %>" />

      <h1>New <%= human_name.downcase %></h1>

      <Form
        <%= singular_table_name %>={<%= singular_table_name %>}
        onSubmit={(form) => {
          form.transform((data) => ({ <%= singular_table_name %>: data }))
          form.post('<%= js_resources_path %>')
        }}
        submitText="Create <%= human_name %>"
      />

      <br />

      <div>
        <Link href="<%= js_resources_path %>">Back to <%= human_name.pluralize.downcase %></Link>
      </div>
    </>
  )
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
inertia_rails-3.5.0 lib/generators/inertia_templates/scaffold/templates/react/New.jsx.tt