inertia

How to work effectively with Inertia, always use when developing frontend features

📖 中文导读:How to work effectively with Inertia, always use when developing frontend features 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。

name: inertia description: How to work effectively with Inertia, always use when developing frontend features

Inertia

Instructions

Inertia + React

  • Use router.visit() or <Link> for navigation instead of traditional links.

import { Link } from '@inertiajs/react'

Home

Inertia + React Forms

import { Form } from '@inertiajs/react'

export default () => (

{({ errors, hasErrors, processing, wasSuccessful, recentlySuccessful, clearErrors, resetAndClearErrors, defaults }) => ( <>
    {errors.name && <div>{errors.name}</div>}

    <button type="submit" disabled={processing}>
        {processing ? 'Creating...' : 'Create User'}
    </button>

    {wasSuccessful && <div>User created successfully!</div>}
    </>
)}
</Form>

)