Hooks
Hooks are special methods within Frames that help building UIs more easily. Here are all of them:
useState
useState
is present both in FunctionComposables and Frames.
Within FunctionComposable it returns a composable-bound state that marks component as dirty on value change,
within Frames it returns a simple reactive state.
useUnboundState
useUnboundState
is present in FunctionComposables and allows to create an unbound state. The component
will not be re-rendered on state value change.
useContext
useContext
is present only in Frames, and it allows to set context to certain value. Context will
be passed down to all components, and they will be able to retrieve it with the context
method.
useContext("Hello, World!");
// ---
@Nullable String ctx = contextOrNull(); // (1)!
@NotNull String ctx = context(); // (2)!
- Will return null if context is not of type
String
- Will throw InvalidContextValue if context is not of type
String
setTitle
setTitle
allows to set title within Frames.
useMemo
useMemo
is used to memoize a Computable<I, O>