state<T> method
(T, void Function(T))
state<T>(
- T initial
Side effect that provides a way for capsules to contain some state.
Similar to the useState
hook from React;
see https://react.dev/reference/react/useState
NOTE
While state will continue to work just fine, it is recommended that newer applications also take a look at data.
Implementation
(T, void Function(T)) state<T>(T initial) => use.lazyState(() => initial);