# rerender

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-view/element/function-rerender/

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

```rust
fn rerender<F, E>(render: F) -> Element
where F: Fn() -> E + 'static,
      E: IntoElement
```

An element of a component that runs again: `render` runs when the
element is mounted and again whenever a signal it read changes or the
component that holds the element runs again; the elements it returns are
compared with those of the run before and the controls are patched
(`docs/declarative-ui.md`, section 8). State that outlives one run is kept
in hooks.

```ignore
fn counter() -> Element {
    rerender(|| {
        let count = use_signal(|| 0);
        button()
            .content(format!("Clicked {} times", count.get()))
            .on_click(move |_| count.update(|c| *c += 1))
            .into()
    })
}
```

Two elements of `rerender` are the same component when their closures are
of the same type: the same place in the code.

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

## Availability

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