This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Description
Right now, we don't produce an error for early returns:
@component
def example():
if True:
return None
use_state() # should produce error
There is no technical reason that this couldn't be supported however, as per this comment:
...semantics get very confusing. What would happen to state below? Would it be reset or preserved? What about effects? Would they be cleaned up (like on unmount) or would they run normally? If you think about it you’ll find cases that are very confusing regardless of the behavior you pick. Therefore, we disallow this pattern altogether. Put early return after calls to Hooks.