Skill / React code quality
Remount state boundaries
Reset state by changing component identity or loading boundaries, not by syncing with effects.
Goal
When an upstream identity changes, remount the stateful branch so initializers naturally receive fresh data.
Review rules for component structure, state ownership, data fetching, and render behavior.
Checks
1Lift the discriminant, such as selected id or route param, above the stateful form or editor.
2Render a skeleton or keyed branch while new data loads so stale state cannot flash.
3Use a key as the narrow fallback when there is no async boundary to restructure around.
Avoid
1useEffect blocks that call several setters to reset a form after props change.
2Rendering an editor once with the previous entity and correcting it after an effect runs.
Source
Imported as local Refined UI skill guidance, with this repo owning the final wording.
Mastra react-best-practices
../mastra/.claude/skills/react-best-practices