Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

useState

Returns a stateful value, and a function to update it.

function useState<S>(initialState: S | (() => S)): [S, StateUpdater<S>];
function useState<S = undefined>(): [S | undefined, StateUpdater<S | undefined>];
§
useState<S>(initialState: S | (() => S)): [S, StateUpdater<S>]
[src]

Returns a stateful value, and a function to update it.

§Type Parameters

§Parameters

§
initialState: S | (() => S)
[src]

The initial value (or a function that returns the initial value)

§Return Type

§
useState<S = undefined>(): [S | undefined, StateUpdater<S | undefined>]
[src]

§Type Parameters

§
S = undefined
[src]

§Return Type

§
[S | undefined, StateUpdater<S | undefined>]
[src]