https://github.com/ctron/yew-consent
Managing consent with Yew
https://github.com/ctron/yew-consent
Last synced: 12 months ago
JSON representation
Managing consent with Yew
- Host: GitHub
- URL: https://github.com/ctron/yew-consent
- Owner: ctron
- License: apache-2.0
- Created: 2023-09-05T15:37:26.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-30T09:02:27.000Z (over 2 years ago)
- Last Synced: 2025-06-09T07:56:52.176Z (12 months ago)
- Language: Rust
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yew-consent
[](https://crates.io/crates/yew-consent)
[](https://docs.rs/yew-consent)
> Managing user consent with Yew
## Usage
Add it to your project:
```shell
cargo add yew-consent
```
Then, add it your application component:
```rust
#[function_component(Application)]
fn application() -> Html {
let ask = use_callback((), |context, ()| html!());
html!(
{ask}>
>
)
}
```
And then, you can check consent later:
```rust
#[function_component(State)]
fn state() -> Html {
let consent = use_consent::<()>();
html!(
<>
- {"Consent state"}
- { format!("{consent:#?}")}
>
)
}
```
Also see the example here: [example](example).
You can run the example using:
```shell
cd example
trunk serve
```