
No Use Effect
- 655 installs
- 101 repo stars
- Updated August 4, 2026
- factory-ai/factory-plugins
no-use-effect is a React review skill that enforces five replacement patterns instead of useEffect so developers who write UI components can use derived state, event handlers, and data-fetching libraries by default.
About
no-use-effect is a Factory plugin skill that bans calling useEffect directly when writing or reviewing React code. It provides five replacement patterns—derived state, event handlers, data-fetching libraries, key resets, and a useMountEffect escape hatch—and maps to a no-restricted-syntax lint rule blocking useEffect. Developers reach for no-use-effect when agents add effects just in case, during PR reviews with unnecessary effects, or while refactoring sync and data-loading logic. The skill cites React docs "You Might Not Need an Effect" as its conceptual foundation.
- Bans direct useEffect in favor of five documented replacement patterns
- Maps deriving state, fetching, events, mount sync, and prop-driven resets to concrete rules
- Pairs with no-restricted-syntax lint banning useEffect
- Includes useMountEffect escape hatch for one-time external sync on mount
- ACTIVATE on new components, refactors, PR review, or agent-added “just in case” effects
No Use Effect by the numbers
- 655 all-time installs (skills.sh)
- +32 installs in the week ending Jul 13, 2026 (Skillselion tracking)
- Ranked #534 of 2,245 Frontend Development skills by installs in the Skillselion catalog
- Security screen: LOW risk (skills.sh audit)
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/factory-ai/factory-plugins --skill no-use-effectAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 655 |
|---|---|
| repo stars | ★ 101 |
| Security audit | 3 / 3 scanners passed |
| Last updated | August 4, 2026 |
| Repository | factory-ai/factory-plugins ↗ |
How do you write React without unnecessary useEffect?
Write and review React UI without defaulting to useEffect—use derived state, event handlers, queries, useMountEffect, or key resets instead.
Who is it for?
React engineers reviewing PRs or pairing with agents that overuse useEffect for sync, fetch, or derived updates.
Skip if: Non-React codebases, teams that rely heavily on intentional effect-driven subscriptions without lint enforcement, or backend-only work.
When should I use this skill?
An agent writes React components, adds useEffect just in case, or a PR introduces useEffect that should be derived state or handlers.
What you get
Components using derived state and handlers, lint-clean TSX without banned useEffect calls, and documented useMountEffect-only exceptions.
- Refactored components without useEffect
- Lint rule configuration for banned effects
By the numbers
- Documents 5 replacement patterns plus a useMountEffect escape hatch
- Uses no-restricted-syntax ESLint rule to ban useEffect
Files
No useEffect
Never call useEffect directly. Use derived state, event handlers, data-fetching libraries, or useMountEffect instead.
Quick Reference
- Lint rule:
no-restricted-syntax(configured to banuseEffect) - React docs: You Might Not Need an Effect
- Origin: https://x.com/alvinsng/status/2033969062834045089
| Instead of useEffect for... | Use |
|---|---|
| Deriving state from other state/props | Inline computation (Rule 1) |
| Fetching data | useQuery / data-fetching library (Rule 2) |
| Responding to user actions | Event handlers (Rule 3) |
| One-time external sync on mount | useMountEffect (Rule 4) |
| Resetting state when a prop changes | key prop on parent (Rule 5) |
When to Use This Skill
- Writing new React components
- Refactoring existing
useEffectcalls - Reviewing PRs that introduce
useEffect - An agent adds
useEffect"just in case"
Workflow
1. Identify the useEffect
Determine what the effect is doing -- deriving state, fetching data, responding to an event, syncing with an external system, or resetting state.
2. Apply the Correct Replacement Pattern
Use the five rules below to pick the right replacement.
3. Verify
npm run lint -- --filter=<package>
npm run typecheck -- --filter=<package>
npm run test -- --filter=<package>The Escape Hatch: useMountEffect
For the rare case where you need to sync with an external system on mount:
The implementation wraps useEffect with an empty dependency array to make intent explicit:
export function useMountEffect(effect: () => void | (() => void)) {
/* eslint-disable no-restricted-syntax */
useEffect(effect, []);
}Replacement Patterns
Rule 1: Derive state, do not sync it
Most effects that set state from other state are unnecessary and add extra renders.
// BAD: Two render cycles - first stale, then filtered
function ProductList() {
const [products, setProducts] = useState([]);
const [filteredProducts, setFilteredProducts] = useState([]);
useEffect(() => {
setFilteredProducts(products.filter((p) => p.inStock));
}, [products]);
}
// GOOD: Compute inline in one render
function ProductList() {
const [products, setProducts] = useState([]);
const filteredProducts = products.filter((p) => p.inStock);
}Smell test: You are about to write useEffect(() => setX(deriveFromY(y)), [y]), or you have state that only mirrors other state or props.
Rule 2: Use data-fetching libraries
Effect-based fetching creates race conditions and duplicated caching logic.
// BAD: Race condition risk
function ProductPage({ productId }) {
const [product, setProduct] = useState(null);
useEffect(() => {
fetchProduct(productId).then(setProduct);
}, [productId]);
}
// GOOD: Query library handles cancellation/caching/staleness
function ProductPage({ productId }) {
const { data: product } = useQuery(['product', productId], () =>
fetchProduct(productId)
);
}Smell test: Your effect does fetch(...) and then setState(...), or you are re-implementing caching, retries, cancellation, or stale handling.
Rule 3: Event handlers, not effects
If a user clicks a button, do the work in the handler.
// BAD: Effect as an action relay
function LikeButton() {
const [liked, setLiked] = useState(false);
useEffect(() => {
if (liked) {
postLike();
setLiked(false);
}
}, [liked]);
return <button onClick={() => setLiked(true)}>Like</button>;
}
// GOOD: Direct event-driven action
function LikeButton() {
return <button onClick={() => postLike()}>Like</button>;
}Smell test: State is used as a flag so an effect can do the real action, or you are building "set flag -> effect runs -> reset flag" mechanics.
Rule 4: useMountEffect for one-time external sync
Good uses: DOM integration (focus, scroll), third-party widget lifecycles, browser API subscriptions.
// BAD: Guard inside effect
function VideoPlayer({ isLoading }) {
useEffect(() => {
if (!isLoading) playVideo();
}, [isLoading]);
}
// GOOD: Mount only when preconditions are met
function VideoPlayerWrapper({ isLoading }) {
if (isLoading) return <LoadingScreen />;
return <VideoPlayer />;
}
function VideoPlayer() {
useMountEffect(() => playVideo());
}Use useMountEffect for stable dependencies (singletons, refs, context values that never change):
// BAD: useEffect with dependency that never changes
useEffect(() => {
connectionManager.on('connected', handleConnect);
return () => connectionManager.off('connected', handleConnect);
}, [connectionManager]); // connectionManager is a singleton from context
// GOOD: useMountEffect for stable dependencies
useMountEffect(() => {
connectionManager.on('connected', handleConnect);
return () => connectionManager.off('connected', handleConnect);
});Smell test: You are synchronizing with an external system, and the behavior is naturally "setup on mount, cleanup on unmount."
Rule 5: Reset with key, not dependency choreography
// BAD: Effect attempts to emulate remount behavior
function VideoPlayer({ videoId }) {
useEffect(() => {
loadVideo(videoId);
}, [videoId]);
}
// GOOD: key forces clean remount
function VideoPlayer({ videoId }) {
useMountEffect(() => {
loadVideo(videoId);
});
}
function VideoPlayerWrapper({ videoId }) {
return <VideoPlayer key={videoId} videoId={videoId} />;
}Smell test: You are writing an effect whose only job is to reset local state when an ID/prop changes, or you want the component to behave like a brand-new instance for each entity.
Component Structure Convention
Computed values come after hooks and local state, never via useEffect:
export function FeatureComponent({ featureId }: ComponentProps) {
// Hooks first
const { data, isLoading } = useQueryFeature(featureId);
// Local state
const [isOpen, setIsOpen] = useState(false);
// Computed values (NOT useEffect + setState)
const displayName = user?.name ?? 'Unknown';
// Event handlers
const handleClick = () => { setIsOpen(true); };
// Early returns
if (isLoading) return <Loading />;
// Render
return <Flex direction="column" gap="lg">...</Flex>;
}Related skills
How it compares
Pick no-use-effect for opinionated React effect elimination; use general React review skills when you need broader hook guidance without banning useEffect.
FAQ
What replaces useEffect in no-use-effect?
no-use-effect lists five patterns: derived state, event handlers, data-fetching libraries, key resets, and useMountEffect as the escape hatch. Direct useEffect calls are banned via a no-restricted-syntax lint rule.
When does no-use-effect activate?
no-use-effect activates when writing React components, refactoring existing useEffect calls, reviewing PRs with effects, or when agents add useEffect just in case during UI implementation.
Is No Use Effect safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.