How to work effectively with React, always use when developing frontend components
/plugin marketplace add markhamsquareventures/essentials/plugin install essentials@mksq-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
This project uses React 19 with TypeScript and the React Compiler enabled via babel-plugin-react-compiler.
resources/js/pages/ and are rendered via Inertiaresources/js/components/resources/js/components/ui/resources/js/hooks/Always receive page data as props from the Laravel controller via Inertia. Do NOT fetch data client-side or use useEffect to load page data.
interface EditProjectProps { project: Project; clients: Client[]; }
export default function EditProject({ project, clients }: EditProjectProps) { return ( <Form action={update({ project: project.id }).url} method="patch"> {/* Form fields using project and clients data */} </Form> ); } </code-snippet>
This pattern ensures:
resources/js/types/index.d.tsReact.ComponentProps<"element"> for extending native element props@/components, @/hooks, @/lib, @/typesinterface CardProps { title: string; description?: string; className?: string; children: React.ReactNode; }
export function Card({ title, description, className, children }: CardProps) { return ( <div className={cn('rounded-lg border p-4', className)}> <h3 className="font-semibold">{title}</h3> {description && <p className="text-muted-foreground">{description}</p>} {children} </div> ); } </code-snippet>
useMemo, useCallback, or React.memo unless profiling shows a specific needuseState and useReducer for local stateusePage())<Form> component (see inertia skill)export function UserGreeting() { const { auth } = usePage<SharedData>().props;
return <span>Hello, {auth.user.name}</span>;
} </code-snippet>
&& for simple conditionals, ternaries for if/elsereturn (
<div>
{data.items.length > 0 && <ItemList items={data.items} />}
{data.error ? <ErrorMessage error={data.error} /> : <SuccessIndicator />}
</div>
);
} </code-snippet>
UserCard.tsx)use prefix (useClipboard.ts)formatDate.ts)edit.tsx, create.tsx, index.tsx)