Hooks
Conditional use API exception
React 19 use can occur in conditions or loops within components or Hooks, not try/catch or arbitrary event handlers.
Formal Syntax & Structure
react syntaxreact
use(resource)Working Example
Example Snippetreact
if (enabled) { value = use(RoomContext); } // context defined elsewhere