# use_hook

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-view/hooks/function-use_hook/

**function** · [`ferroui-view`](/docs/0.5.0/api/ferroui-view/) · v0.5.0

```rust
fn use_hook<T: Clone + 'static>(init: impl FnOnce() -> T) -> T
```

A value made by `init` on the first run of the component and handed back
(cloned) on the next ones: the slot every other hook is built on. `init`
runs with the component as the owner, so what it makes lives as long as
the component.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.View/hooks.rs#L149)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
