Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow customizing the struct properties name #6

Merged
merged 3 commits into from
Oct 30, 2023
Merged

Allow customizing the struct properties name #6

merged 3 commits into from
Oct 30, 2023

Conversation

cecton
Copy link
Member

@cecton cecton commented Oct 30, 2023

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() {
    }
}

@valyagolev valyagolev merged commit bb2772d into yewstack:master Oct 30, 2023
1 check passed
@cecton cecton deleted the rename-prop-struct branch October 30, 2023 11:50
@cecton
Copy link
Member Author

cecton commented Oct 30, 2023

Oops sorry i didnt see the check!

@valyagolev
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants