Skip to content

useState

The useState hook creates a mutable observable which can be used to keep state across re-renders of a component.

tsx
const state = useState(initialState?)

Usage

Use the useState hook at the top level of your component to declare mutable state.

tsx
import { useState } from "bosk";

function Counter() {
  const count = useState(0);
  // ...

Released under the MIT License.