ai11y docs
    Preparing search index...

    Function setState

    • Merges new state with existing state (similar to React's setState) Pass undefined to clear all state

      Parameters

      • newState: Ai11yState | undefined

        Partial state to merge, or undefined to clear

      Returns void

      setState({ userId: '123' }); // Merges with existing state
      setState({ theme: 'dark' }); // Adds to state, keeps userId
      setState(undefined); // Clears all state