Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ctron/yew-consent
Managing consent with Yew
https://github.com/ctron/yew-consent
Last synced: 4 days 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 (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-30T09:02:27.000Z (12 months ago)
- Last Synced: 2024-05-02T06:15:10.308Z (6 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
[![crates.io](https://img.shields.io/crates/v/yew-consent.svg)](https://crates.io/crates/yew-consent)
[![docs.rs](https://docs.rs/yew-consent/badge.svg)](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
```