inertia

生成用于构建单页应用程序的Inertia.js配置和脚本。运行本地命令以调试和部署。

📖 中文导读:生成用于构建单页应用程序的Inertia.js配置和脚本。运行本地命令以调试和部署。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。

name: inertia description: Generates Inertia.js configurations and scripts for building single-page applications. Run local commands to debug and deploy.


Instructions

Inertia Core

  • Inertia.js components should be placed in the resources/js/Pages directory unless specified differently in the JS bundler (vite.config.js).
  • Use Inertia::render() for server-side routing instead of traditional Blade views.
  • Use search-docs for accurate guidance on all things Inertia.
// routes/web.php example Route::get('/users', function () { return Inertia::render('Users/Index', [ 'users' => User::all() ]); });

Inertia v2

  • Make use of all Inertia features from v1 & v2. Check the documentation before making any changes to ensure we are taking the correct approach.

Inertia v2 New Features

  • Polling
  • Prefetching
  • Deferred props
  • Infinite scrolling using merging props and WhenVisible
  • Lazy loading data on scroll

Deferred Props & Empty States

  • When using deferred props on the frontend, you should add a nice empty state with pulsing / animated skeleton.

Inertia Form General Guidance

  • Build forms using the useForm helper. Use the code examples and search-docs tool with a query of useForm helper for guidance.