#Weird error when using children props

1 messages · Page 1 of 1 (latest)

remote tartan
#

Here is my code:

use yew::prelude::*;

#[derive(Properties, PartialEq)]
pub struct SplitProps {
    pub children: Html,
}

#[function_component]
pub fn HSplit(props: &SplitProps) -> Html {
    html! {
        <div class="hsplit">
            { props.children.clone() }
        </div>
    }
}

#[function_component]
pub fn App() -> Html {
    html! {
        <>
            <HSplit>
                <p>{"Hi there"}</p>
            </HSplit>
        </>
    }
}

Error below

#

And I get this error:

error[E0277]: the trait bound `ChildrenRenderer<_>: IntoPropValue<VNode>` is not satisfied
  --> src/app.rs:33:5
   |
33 | /     html! {
34 | |         <>
35 | |             <HSplit>
   | |              ------ required by a bound introduced by this call
36 | |                 <p>{"Hi there"}</p>
...  |
39 | |         </>
40 | |     }
   | |_____^ the trait `IntoPropValue<VNode>` is not implemented for `ChildrenRenderer<_>`
   |
   = help: the following other types implement trait `IntoPropValue<T>`:
             <indexmap::map::IndexMap<K, V> as IntoPropValue<implicit_clone::unsync::IMap<K, V>>>
             <VChild<T> as IntoPropValue<ChildrenRenderer<VChild<T>>>>
             <VChild<T> as IntoPropValue<Option<ChildrenRenderer<VChild<T>>>>>
             <Classes as IntoPropValue<implicit_clone::unsync::IString>>
             <Classes as IntoPropValue<Option<implicit_clone::unsync::IString>>>
             <Rc<str> as IntoPropValue<implicit_clone::unsync::IString>>
             <Rc<str> as IntoPropValue<Option<implicit_clone::unsync::IString>>>
             <VNode as IntoPropValue<ChildrenRenderer<VNode>>>
           and 23 others
note: required by a bound in `SplitPropsBuilder::children`
  --> src/app.rs:17:10
   |
17 | #[derive(Properties, PartialEq)]
   |          ^^^^^^^^^^ required by this bound in `SplitPropsBuilder::children`
18 | pub struct SplitProps {
19 |     pub children: Html,
   |         -------- required by a bound in this associated function
   = note: this error originates in the macro `html` which comes from the expansion of the derive macro `Properties` (in Nightly builds, run with -Z macro-backtrace for more info)
normal canyon
#

is this yew 0.21? either way, try children: Children

remote tartan
#

yeah it works now

remote tartan
#

should i update to 0.21?