yewstack / yew-autoprops

Apache License 2.0
8 stars 1 forks source link

Allow customizing the struct properties name #6

Closed cecton closed 12 months ago

cecton commented 12 months ago

This change will allow the user to customize the name of the Properties struct. Most of the time the user won't care so the default will be as before but in case they do care (when making libraries of components for example), this is now possible.

use yew_autoprops::autoprops_component;
use yew::prelude::*;

#[autoprops_component(CoolComponent, CoolProps)]
fn cool_component(#[prop_or_default] test: &i8, smth: &usize) -> Html {
    println!("test: {}", test);

    html! {
        <div>
            <p>{ smth }</p>
        </div>
    }
}

impl CoolProps {
    fn foo() {
    }
}
cecton commented 12 months ago

Oops sorry i didnt see the check!

valyagolev commented 12 months ago

Released as 0.3.0. Maybe update the README too if you have the time ;-)