Saltar al contenido principal

Sort logic into render, event, ref, or Effect

Classify component logic as render calculation, event handler work, ref storage, or Effect synchronization.

react-basics5 min read

Sort each logic example into the correct React home. Render calculation Event handler Ref Effect Calculate visibleRows from rows and query Compute totalPrice from cart items Show a toast after the user clicks Save and the request succeeds Send a form POST because the user submitted the form Hold a timeout ID so it can be cleared later without rendering Hold an input DOM node for focus Subscribe to a window resize event and clean it up Connect a chat socket when roomId changes and disconnect on cleanup

Read the full lesson

Sign up free: one personalized lesson every day, matched to your role and goals.

← Back to library

Contáctanos