; useState with array destructuring: const [value, setValue] = useState(init)
(lexical_declaration
  (variable_declarator
    name: (array_pattern
      (identifier) @hook.var
      (identifier) @hook.setter)
    value: (call_expression
      function: (identifier) @hook.fn
      arguments: (arguments . (_) @hook.init)
      (#match? @hook.fn "^use[A-Z]"))))

; useReducer: const [state, dispatch] = useReducer(reducer, init)
(lexical_declaration
  (variable_declarator
    name: (array_pattern
      (identifier) @reducer.var
      (identifier) @reducer.dispatch)
    value: (call_expression
      function: (identifier) @_useReducer
      arguments: (arguments
        (_) @reducer.fn
        (_) @reducer.init)
      (#eq? @_useReducer "useReducer"))))
