rewright
    Preparing search index...

    Function useState

    • A function for managing state within a class or function. The managed state is globally available.

      Parameters

      • name: string

        the name of the state to be managed.

      • OptionaldefaultValue: any

        optional; the default value of the state.

      Returns [StateGetter, StateSetter]

      A getter and setter function for the managed state.

      function foo() {
      const [getMyState, setMyState] = useState("myState", false);
      }