nestedHookCall`{{inner}}` is called inside the `{{outer}}` call. Assign its result to a variable first.small-rules/no-nested-hook-callsDisallow nesting a hook call inside another hook call.
A hook call nested inside another hook call hides a value that never gets a name. Take
useAttribute(useCharacter(), "Health"). To see what the outer hook receives, the reader has to run the
inner call in their head. The line also grows long enough to wrap.
Assign the inner result to a const first. The variable gives the value a name and keeps each hook call on
its own line. Later code can reuse it too.
The rule only checks the expression of a hook call: its arguments and its callee. A hook called inside a
function passed to another hook, such as a component handed to an overlay hook, belongs to
use-hook-at-top-level.
nestedHookCall`{{inner}}` is called inside the `{{outer}}` call. Assign its result to a variable first.This rule does not accept options.
const health = useAttribute(useCharacter(), "Health");const character = useCharacter();const health = useAttribute(character, "Health");