arrow_backBACK TO DRILLS
White Beltrules-of-hookslockPREMIUM

Conditional Hook calls vs regular functions

A component conditionally calls getSorted(items) inside an if block. The function sorts an array but does not call any Hooks internally. Why is this valid React code?

lock

This Drill is Locked

This is a premium drill. Continue on to the next free drill in the sequence.

CONTINUE DRILLarrow_forward
BugDojo
BlogFAQ

© 2026. Carved in code.