Function ambient_api::prelude::ambient_element::use_ref_with
source · pub fn use_ref_with<T>(
hooks: &mut Hooks<'_>,
init: impl FnOnce(&mut World) -> T
) -> Arc<Mutex<RawMutex, T>>
Expand description
Provides internally mutable state that is preserved between re-renders.
This should be used over use_state when reference semantics are required for the state as opposed to value semantics.
Note: Locking the mutex and modifying the value won’t cause a re-render. To re-render the element, use use_rerender_signal.