new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Mantine · all subjects

hooks/use-state-history

5 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

useStateHistory hook overview

The useStateHistory hook creates a state with history. It returns the current value, handlers to go back/forward, and a history object with all previous values and the current index.

UseStateHistoryHandlers interface

UseStateHistoryHandlers<T> interface has the following properties: set (function that takes value: T), back (function that takes optional steps parameter), forward (function that takes optional steps parameter), and reset (function with no parameters).

UseStateHistoryValue interface

UseStateHistoryValue<T> interface has the following properties: history (array of type T) and current (number representing the current index).

useStateHistory return type

useStateHistory<T>(initialValue: T) returns UseStateHistoryReturnValue<T>, which is a tuple type: [T, UseStateHistoryHandlers<T>, UseStateHistoryValue<T>]. The first element is the current value, the second is the handlers object, and the third is the history value object.

useStateHistory exported types

The types UseStateHistoryHandlers, UseStateHistoryReturnValue, and UseStateHistoryValue can be imported from @mantine/hooks.

Give your agent this brain