Function ambient_element::use_effect
source · pub fn use_effect<D: PartialEq + Debug + Sync + Send + 'static, R: FnOnce(&mut World) + Sync + Send + 'static>(
hooks: &mut Hooks<'_>,
dependencies: D,
run: impl FnOnce(&mut World, &D) -> R + Sync + Send
)
Expand description
Run a function for its side effects each time a dependency changes.
The function should return another function; that function will be called when the Element is unmounted.