Skip to content

@inquirer/core@12.0.0

Choose a tag to compare

@SBoudrias SBoudrias released this 19 Aug 17:33
· 1 commit to main since this release
Immutable release. Only release title and notes can be modified.

@inquirer/core@12.0.0

⚠️ Breaking change

The setter returned by useState now accepts an updater/reducer function (currentValue) => nextValue, mirroring React. The updater always receives the latest state (read from the hook store at call time), which simplifies async and reducer-style state updates.

Type change: the setter signature moves from (newValue: Value) => void to (newValue: NotFunction<Value> | Reducer<Value>) => void.

Impact: any code that stored a function as a value via useState's setter now has that function interpreted as a reducer. This is a type-level breaking change for consumers of the core hook API.

What's new

  • useState setter accepts a reducer function (currentValue) => nextValue (#2225)

Dependencies

  • @inquirer/figures bumped to ^2.0.8