stateGetterSetter<T> method

  1. @Deprecated('Use `use.data` instead')
ValueWrapper<T> stateGetterSetter<T>(
  1. T initial
)

Side effect that provides a way for capsules to contain some state. Further, instead of returning the state directly, this instead returns a getter that is safe to capture in closures.

Similar to the useState hook from React; see https://react.dev/reference/react/useState

NOTE

New applications are recommended to use data instead.

Implementation

@Deprecated('Use `use.data` instead')
ValueWrapper<T> stateGetterSetter<T>(T initial) => use.data(initial);