adjustStateThis effect adjusts state when a prop changes. Adjust the state directly during rendering or restructure to avoid this need.small-rules/no-useless-use-effectDisallow empty effects, duplicate dependencies, effect chains, log-only effects, derived state, external-store state sync, state initialization, reset effects, parent notifications, parent ref callbacks, and event side effects routed through state.
adjustStateThis effect adjusts state when a prop changes. Adjust the state directly during rendering or restructure to avoid this need.derivedStateThis effect only derives state from properties or state. Compute the value during rendering instead of useEffect.duplicateDepsMultiple effects have identical dependency arrays. Combine them into a single effect for better performance.effectChainThis effect is part of a chain of effects that only derive state from other effects. Consolidate the logic into event handlers or compute during rendering.emptyEffectThis effect has an empty body and should be removed.eventFlagThis effect only reacts to a state flag. Call the side effect directly in the event handler instead of toggling state.eventSpecificLogicThis effect runs event-specific logic based on state. Move this logic to the event handler that triggers the state change.externalStoreThis effect subscribes to an external store and syncs to state. Use `useSyncExternalStore` instead.initializeStateThis effect initializes state with a constant value. Pass the value as the useState initializer instead.logOnlyThis effect only contains console.log calls. Remove it (debug leftover) or move the logging to an event handler.mixedDerivedStateThis effect contains state setter calls that derive values from props or state mixed with other operations. Extract the setter calls and compute values during rendering.notifyParentThis effect only notifies a parent via a property callback. Call the callback in the event handler instead of useEffect.passRefToParentThis effect passes a ref to a parent callback. Use `forwardRef` or `useImperativeHandle` instead.resetStateThis effect resets state when a prop changes. Pass a `key` prop to the component instead to reset all state automatically.This rule accepts one options object after the severity.
import { useEffect, useState } from "@rbxts/react";
function Component(properties) { const [count, setCount] = useState(0);useEffect(() => { setCount(properties.initialCount);}, [properties.initialCount]);}import { useEffect } from "@rbxts/react";
function Component() {useEffect(() => { trackPageView("/home");}, []);}