Skip to content

yewstack/yew-autoprops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yew-autoprops

Crate Info API Docs

proc-macro to automatically derive Properties structs from args for Yew components

No more extra one-off Props structs!

Examples

use yew_autoprops::autoprops;
use yew::prelude::*;

#[autoprops]
#[function_component]
fn CoolComponent(#[prop_or_default] hidden: bool, smth: &AttrValue) -> Html {
    html! {
        <div class={classes!(hidden.then_some("hidden"))}>
            <p>{ smth }</p>
        </div>
    }
}
use yew_autoprops::autoprops;
use yew::prelude::*;

#[autoprops(CoolComponentProps)]
#[function_component(CoolComponent)]
fn cool_component(#[prop_or_default] hidden: bool, smth: &AttrValue) -> Html {
    html! {
        <div class={classes!(hidden.then_some("hidden"))}>
            <p>{ smth }</p>
        </div>
    }
}

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages