react-useeffect
/react-useeffect
Stosuje dobre praktyki useEffect z oficjalnej dokumentacji React i uczy, kiedy Effect jest zbędny, oraz pokazuje lepsze alternatywy dla wartości pochodnych, pobierania danych i synchronizacji stanu.
- Autor
- davila7 ↗
- Repozytorium
- claude-code-templates ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 25.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 4
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 25.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Stosuje dobre praktyki useEffect z oficjalnej dokumentacji React i uczy, kiedy Effect jest zbędny, oraz pokazuje lepsze alternatywy dla wartości pochodnych, pobierania danych i synchronizacji stanu.
Oryginalny opis (EN)
React useEffect best practices from official docs. Use when writing/reviewing useEffect, useState for derived values, data fetching, or state synchronization. Teaches when NOT to use Effect and better alternatives.
Jak działa
- Quick Reference
- When You DO Need Effects
- When You DON'T Need Effects
- Decision Tree
- Detailed Guidance
Podgląd SKILL.md
---
name: react-useeffect
description: React useEffect best practices from official docs. Use when writing/reviewing useEffect, useState for derived values, data fetching, or state synchronization. Teaches when NOT to use Effect and better alternatives.
---
# You Might Not Need an Effect
Effects are an **escape hatch** from React. They let you synchronize with external systems. If there is no external system involved, you shouldn't need an Effect.
## Quick Reference
| Situation | DON'T | DO |
|-----------|-------|-----|
| Derived state from props/state | `useState` + `useEffect` | Calculate during render |
| Expensive calculations | `useEffect` to cache | `useMemo` |
| Reset state on prop change | `useEffect` with `setState` | `key` prop |
| User event responses | `useEffect` watching state | Event handler directly |
| Notify parent of changes | `useEffect` calling `onChange` | Call in event handler |
| Fetch data | `useEffect` without cleanup | `useEffect` with cleanup OR framework |
## When You DO Need Effects
- Synchronizing with **external systems** (non-React widgets, browser APIs)
- **Subscriptions** to external stores (use `useSyncExternalStore` when possible)
- **Analytics/logging** that runs because component displayed
- **Data fetching** with proper cleanup (or use framework's built-in mechanism)
## When You DON'T Need Effects
1. **Transforming data for rendering** - Calculate at top level, re-runs automatically
2. **Handling user events** - Use event handlers, you know exactly what happened
3. **Deriving state** - Just compute it: `const fullName = firstName + ' ' + lastName`
4. **Chaining state updates** - Calculate all next state in the event handler
## Decision Tree
```
Need to respond to something?
├── User interaction (click, submit, drag)?
│ └── Use EVENT HANDLER
├── Component appeared on screen?
│ └── Use EFFECT (external sync, analytics)
├── Props/state changed and need derived value?
│ └── CALCULATE DURING RENDER
│ └── Expensive? Use useMemo
└── Need to reset state when prop changes?
└── Use KEY PROP on component
```
## Detailed Guidance
- [Anti-Patterns](./anti-patterns.md) - Common mistakes with fixes
- [Better Alternatives](./alternatives.md) - useMemo, key prop, lifting state, useSyncExternalStore
Pliki w paczce (4)
- README.md 10 KB
- SKILL.md 2 KB
- alternatives.md 6 KB
- anti-patterns.md 6 KB
Wersje
W bazie nie ma innych skilli o nazwie react-useeffect.
Identyczna treść występuje jeszcze w 7 innych folderach na GitHubie. Tu pokazujemy jedną, najlepiej ocenioną kopię.
Migawka bazy z 13.11.2026 · wersja paczki 298701645cbd (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100no-use-effect
Ogranicza zbędne useEffect w React, kierując kod do stanu pochodnego, obsługi zdarzeń, formularzy, resetów przez key i bibliotek danych. - 100no-use-effect
Ogranicza zbędne użycie useEffect w React, kierując kod ku stanowi pochodnemu, obsłudze zdarzeń, memoizacji, resetom przez key, useSyncExternalStore i API danych frameworka. - 100state-discipline
Stosuje dyscyplinę stanu w React 19 i Next.js 16: useState jako ostateczność, wartości pochodne z propsów, URL i danych, key do resetowania i useMountEffect zamiast gołego useEffect. - 100react-best-practices
Pisze i przegląda komponenty, hooki i pobieranie danych w React według zasad wydajności, także kiedy nie używać efektów. - 100no-use-effect
Pilnuje, by w React i React Native nie używać useEffect wprost, zamiast tego stosując stan pochodny, zdarzenia lub useMountEffect. - 100no-use-effect
Unika bezpośredniego użycia useEffect w React: zastępuje go stanem pochodnym, bibliotekami zapytań, obsługą zdarzeń, useMountEffect lub remountem po key.