Managing user consent with Yew
Add it to your project:
shell
cargo add yew-consent
Then, add it your application component:
```rust
fn application() -> Html {
let ask = use_callback(|context, ()| html!(
html!(
<Consent<()> {ask}>
<State/>
</Consent<()>>
)
} ```
And then, you can check consent later:
```rust
fn state() -> Html { let consent = use_consent::<()>();
html!(
<>
<dl>
<dt>{"Consent state"}</dt>
<dd>{ format!("{consent:#?}")}</dd>
</dl>
</>
)
} ```
Also see the example here: example.
You can run the example using:
shell
cd example
trunk serve