

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
1234567# React: Apply `useEffect` Dependency Best Practices89**Your task: When using `useEffect` in React components, ensure dependency arrays are correctly managed to prevent infinite loops and optimize performance.**1011## Guiding Principle1213To avoid infinite loops with `useEffect`, **DO NOT** include functions in the dependency array if they are redefined on every render. For effects that should only run on component mount and unmount, use an empty dependency array (`[]`).1415If a function *must* be a dependency because its identity or behavior changes and should trigger the effect, **ALWAYS** memoize it using `useCallback`.1617### Examples1819**Incorrect (Potential Infinite Loop):**20```tsx21useEffect(() => {22 fetchNotes();23}, [fetchNotes]); // PROBLEM: fetchNotes is typically re-created every render, causing an infinite loop if not memoized.24```2526**Correct (Runs Only on Mount):**27```tsx28useEffect(() => {29 fetchNotes();30}, []); // INTENT: Effect runs once after initial render.31```3233**Correct (Function as a Memoized Dependency):**34```tsx35const fetchNotes = useCallback(() => {36 // ... logic for fetching notes ...37}, []); // useCallback memoizes fetchNotes, its identity is stable unless its own dependencies change.3839useEffect(() => {40 fetchNotes();41}, [fetchNotes]); // CORRECT: Effect re-runs only if fetchNotes (due to its own useCallback dependencies) changes.42```4344**REMEMBER: Always critically evaluate `useEffect` dependencies. Use an empty array `[]` for mount-only effects. If a function is a dependency, ensure it's stable by wrapping it in `useCallback`.**45
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| skillrecordings/egghead-next.cursor/rules/_global.mdc · 1.4k | Cursor rules | teststyletypesgit+1 | 89/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/benchmarks-create.mdc · 1.4k | Cursor rules | no sections | 38/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/cli-github-search.mdc · 1.4k | Cursor rules | no sections | 51/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/cli-wrangler.mdc · 1.4k | Cursor rules | styledatabase | 52/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/docs-openapi-spec.mdc · 1.4k | Cursor rules | archapi | 58/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/docs-prd.mdc · 1.4k | Cursor rules | archagent-behaviourdocs | 58/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/docs-structure.mdc · 1.4k | Cursor rules | archdocs | 49/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/docs-sync.mdc · 1.4k | Cursor rules | docs | 45/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/docs-tech-stack.mdc · 1.4k | Cursor rules | testlint-formatarchagent-behaviour+1 | 58/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/gh-docs-sync.mdc · 1.4k | Cursor rules | docs | 53/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/gh-task-continue.mdc · 1.4k | Cursor rules | git | 65/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/gh-task-plan.mdc · 1.4k | Cursor rules | teststylearchtypes+2 | 96/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/logging-session.mdc · 1.4k | Cursor rules | lint-formatstylearchgit | 62/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/pnpm-fixes.mdc · 1.4k | Cursor rules | setupbuildstyledependencies | 68/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/project-todos-next.mdc · 1.4k | Cursor rules | docs | 45/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/project-update-user-rules.mdc · 1.4k | Cursor rules | buildtestlint-formatstyle+7 | 96/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/pull-request-create.mdc · 1.4k | Cursor rules | git | 69/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/scripts-create.mdc · 1.4k | Cursor rules | types | 53/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/task-next.mdc · 1.4k | Cursor rules | no sections | 45/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/task-outline.mdc · 1.4k | Cursor rules | do-not | 52/100 | 14 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 46 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 14 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 14 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 14 days ago | |
| bybren-llc/safe-agentic-workflow.cursor/rules/10-backend-python.mdc · 399 | Cursor rules | testlint-formatstylegit+4 | 97/100 | today |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/skillrecordings-egghead-next-cursor-rules-react-rules)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.