28 react rules available
Cursor's React collection has 28 exact matches, including Next.js rules tagged react and short rules on portals, tables, profiling and forms. The file below covers React itself for .tsx/.jsx files; Next.js-specific behavior belongs on the Next.js page.
Cursor applies project rules stored as .mdc files in .cursor/rules. Each rule's frontmatter (description, globs, alwaysApply) decides whether it is always included, attached to matching files, chosen by the agent from its description, or only used when you @-mention it. Cursor also reads AGENTS.md in the project root and subdirectories for plain-Markdown instructions.
.cursor/rules/react.mdcStarting point, not a tested configuration for your repository. Attached when files matching the globs are in context (alwaysApply: false with globs). Review the instructions, adapt the file paths and run your project's existing checks.
--- description: "React development project conventions" globs: "**/*.tsx,**/*.jsx" alwaysApply: false --- # React instructions for Cursor ## Focus for this project - On React 19, prefer form actions with useActionState for submit state; on React 18 use the project's form library. - Show a pending state and an error message for every async submit. - Wrap independently failing sections in error boundaries. ## React conventions - Write function components and custom hooks; call hooks only at the top level of components or other hooks. - Derive values during render instead of copying props into state, and do not use an effect only to transform data for rendering. - Check the react version in package.json: on React 19, function components receive ref as a regular prop and forwardRef is not needed for new components; on React 18 keep forwardRef. - In tests, query by role and accessible name with Testing Library rather than by class names or test IDs. ## Before you finish - Run the type checker (npx tsc --noEmit for TypeScript projects), the lint script and the component tests and report the actual output. If you cannot run them, say so and list the exact commands instead of saying they pass. - Summarize which of the rules above affected the change. - If another attached Cursor rule conflicts with this one, name both rules and follow the one with the narrower globs.
Create your own Cursor rules for React and share with the community.
Ask for a small change to one matching file. Check the tool's loaded context or instruction view, inspect the diff for the requested convention, and run the relevant build or test. A well-formatted file does not guarantee the model follows every instruction.
Cursor's docs recommend keeping individual rules under 500 lines and splitting large rules into composable ones. Cursor's documentation states that it supports AGENTS.md in the project root and in subdirectories. Use AGENTS.md for plain-Markdown instructions you also want other tools to read, and .mdc rules when you need Cursor's scoping options (globs, description-based selection, always-apply).
Documentation checked 2026-11-05: Cursor docs: Rules
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
You ask Cursor's agent to add a form and want React 19 Actions where the project supports them and controlled inputs otherwise.
Add a newsletter signup form that posts an email and shows success or the server error.
A form using useActionState (React 19) or the existing form library, a labelled email input, pending and error states, a Testing Library test for success and failure, and test output.
Content reviewed 2026-11-05. Confirm instruction activation in your installed client before relying on it.
Cursor rules for React with TypeScript: typed function components, React 19 ref-as-prop, hooks discipline, state ownership, error boundaries and measured performance work.