Effects, refs, and tests quick reference
Recall when to use Effects, refs, and user-centered component tests.
Effect objection I put filtering in an Effect because it runs when the query changes. The filtered list is derived from props and state. Your response Calculate filtered rows during render; reserve Effects for external synchronization. A derived-value Effect adds a stale render and a second update. Render calculations rerun automatically when props or state change. Ref vs state Where should a timeout ID live? Use refs for mutable values that should not cause rendering. External sync What is the fastest test for whether an Effect is appropriate? Name the external system being synchronized. Examples: browser event, socket, timer, third-party…
Sign up free — one personalized lesson every day, matched to your role and goals.
Already have an account? Sign in