• アドバイスや指摘はwelcomeです! • Since I’ve started to use React Router V7, I’ve been researching which implementation patterns seem better (I’m still new to this, so there’s a lot I don’t know yet) • Most of what I’ll be discussing here can be found in the bulletproof-react doc • Any advice or suggestions are very welcome!
ルーティングライブラリ • 対抗としてNext.jsが挙げられることが多い(私はNext.jsも好きです) • Web標準な処理を書けることが多い(特にフォーム) • A routing library for linking “URLs (paths)” to “displayed screens (components)” in React apps • Next.js is often cited as a competitor; I also like Next.js! • It often allows for writing code that adheres to web standards (especially for forms)
プロジェクト構成・規約・API層・状態管理・テスト・エラーハンドリング・セキュリティ等をド キュメント化 ◦ 今回はapps/react-viteフォルダの構成を検討 • “Design Guide” for React Apps • A repository that provides a scalable architecture • Doc covering project structure, conventions, API layers, state management, testing, error handling, security, and more ◦ This time, I'll examine the structure of the `apps/react-vite` folder
画面データの再取得が必要な場合は useRevalidator() で再読み込みが可能 • ルートオブジェクト(コンポーネント)のLoaderの再検証(再実行)条件の調整も可能 • Using Loaders and Actions allows you to decouple API request handling from components, which reduces the number of `useEffect` hooks used for data fetching; `useEffect` hooks are still required for tasks such as timers • If you need to re-fetch screen data, you can use `useRevalidator()` to trigger a reload • You can also adjust the revalidation (re-execution) conditions for the Loader associated with the root object (component).
case with bulletproof-react, for apps that are somewhat complex and large, React-Hook-Form + Zod seems like a better choice than React Router’s default Form component • Since it makes it easy to intuitively understand the connection between routing and components, I think it’s a good option for beginners as well • I can sense a steely determination to separate the API layer from the components using Loaders and Actions ◦ Presumably, no matter how you write it, these elements will be separated to some extent • I’m curious about where the framework’s limits lie, such as the constraints encountered when trying to improve performance