rememberMirrorState

@Composable
fun <V> rememberMirrorState(initial: V): MirrorState<V>

Remembers the MirrorState a component settles a declaration through, seeded with initial - what the widget will actually hold on the first pass, which is not always what the composition declares for it: a ToolBar is always docked when it is built, whatever floating its first declaration asks for, so its seed is false rather than the declaration.

A later initial does not recreate the record or write the widget - declare settles against the value passed to it on every pass, not against initial.

One record serves one node, remembered in that node's own group so that it is released with the node. The record holds what declare compares each pass's declaration against, so a record shared between nodes, or remembered above the node it settles, goes on answering for a widget that is no longer there

  • and the widget built in its place keeps the value its constructor gave it instead of the standing declaration.

Return

the record to hand declare for every pass of the node it belongs to.

Parameters

initial

what the widget holds before anything is declared onto it, read once when the record is created.