Main App cannot be autoprops
kirillsemyonkin opened this issue · 6 comments
For consistency reasons, I tried to write following:
#[autoprops_component]
fn App() -> Html {
html! {}
}
This comes up with following error on a CSR render:
the function or associated item `new` exists for struct `Renderer<App>`, but its trait bounds were not satisfied
the following trait bounds were not satisfied:
`AppProps: std::default::Default`
- doesn't satisfy `AppProps: std::default::Default`
- consider annotating `AppProps` with `#[derive(Default)]`: `#[derive(Default)]`
This is probably due to fact that props struct generates for App
even if there are no props (as mentioned in #7).
- Get rid of generating a props struct for propless autoprops components
- Otherwise possibly make empty struct a
Default
? (Also, consider manualimpl Default
where all types areDefault
- this is possible by listingwhere type1: Default, type2: Default
, no matter how simple or complex the type is - you can even type outwhere i32: Default
and it will still work)
Thank you for all of the reports. To be honest, I don't use yew
anymore (primarily switched to dioxus
), and will unlikely tackle any of the issues myself. But you're welcome to send PRs, and I can give you commit rights too
I don't use
yew
anymore
Its all good if you still accept PRs and release new versions, otherwise consider transferring ownership
Its all good if you still accept PRs and release new versions,
I won't mind for now
otherwise consider transferring ownership
If anyone is interested, why not
If anyone is interested, why not
That would be me, @cecton, or, if possible, yewstack
I don't think it will be necessary. I will make a PR now to port the feature to Yew. If it succeeds, you will be able to archive the repository
This one is already fixed in the autoprops port on Yew