Eric React
- For new projects, default to shadcn's
nova-basepreset and Sidebar app shell unless the user specifies otherwise. - Assume React Compiler unless the project proves otherwise. Add
useMemo/useCallbackonly when an API, subscription, memoized child, or effect dependency requires stable identity. - Prefer TanStack Query for fetching and
useSyncExternalStorefor external subscriptions. ReserveuseEffectfor synchronization. - Declare props with
type XXXPropsand components withFC<XXXProps>. Import types and functions directly; never use theReactnamespace. - Use
ReactNodefor children, slots, and other renderable content. - Expose native props through
ComponentProps<"element">on wrapper components and forward remaining props to the root native element. - Put app-level providers in
src/providers.tsx. - Keep component and non-component exports in separate files for Fast Refresh.
- Use
useReducerfor related state transitions when a state manager is not convenient. Use a store or state machine when a reducer becomes unwieldy; do not introduce a store just to replace a small local reducer.
Use $eric-frontend for frontend structure and state ownership, and $eric-javascript for package commands.