647 Members
4 Servers

Load older messages

29 Jan 2023
@_discord_342689867161010176:t2bot.ioPitohuiRedacted or Malformed Event16:45:25
@_discord_342689867161010176:t2bot.ioPitohuiRedacted or Malformed Event16:45:50
@_discord_718124859997159485:t2bot.iob0x_Cub3d#6689 Oh, that one 16:45:50
@_discord_718124859997159485:t2bot.iob0x_Cub3d#6689 most 16:45:56
@_discord_718124859997159485:t2bot.iob0x_Cub3d#6689 I don't use that tutorial since it uses a lot of stuff that doesn't apply to my current project. 16:46:42
@_discord_718124859997159485:t2bot.iob0x_Cub3d#6689 the one in the playlist is better since it goes in about how it works. 16:47:04
@_discord_342689867161010176:t2bot.ioPitohuiRedacted or Malformed Event16:47:17
@_discord_342689867161010176:t2bot.ioPitohuiRedacted or Malformed Event16:49:06
@_discord_718124859997159485:t2bot.iob0x_Cub3d#6689 I kinda was until I started looking into JS, web-sys, and bit more into Rust itself. 16:51:42
@_discord_342689867161010176:t2bot.ioPitohuiRedacted or Malformed Event17:33:59
@_discord_718124859997159485:t2bot.iob0x_Cub3d#6689 Honestly, I'm pretty new to the whole thing the person who uploaded those videos is in this server so you can ask him. 17:34:48
@_discord_342689867161010176:t2bot.ioPitohuiRedacted or Malformed Event17:36:24
@_discord_718124859997159485:t2bot.iob0x_Cub3d#6689 That should be him. 17:37:29
@_discord_342689867161010176:t2bot.ioPitohuiRedacted or Malformed Event17:42:09
@_discord_804012467063619654:t2bot.iogsmlg joined the room.17:50:39
@_discord_321674101712224256:t2bot.ioJaro#5648 joined the room.21:52:33
@_discord_321674101712224256:t2bot.ioJaro#5648 Hi, I'm trying to make a component with dynamically created input fields (based on an API call).

I have a struct component:
pub struct PracticeComponent {
    input_refs: Vec<NodeRef>,

and my Component implementation looks like this:
impl Component for PracticeComponent {
    type Message = Msg;
    type Properties = PracticeComponentProperties;

    fn create(ctx: &Context<Self>) -> Self {
        let package = &ctx.props().package;
        Self {
            input_refs: vec![NodeRef::default(); package.inputs.len()],

    fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
        for i in 0..self.input_refs.len() {
            if let Some(input) = self.input_refs[i].cast::<HtmlInputElement>() {
                console!(format!("I: {0}, Id: {1}", i, input.id()));
        true // Whether to render the component after update
    fn view(&self, ctx: &Context<Self>) -> Html {
        html! {
            <div class="m-6 mx-10">
                <div class="flex flex-col space-y-4">
                        .map( |(i, input)| {
                            let nref = self.input_refs[i].clone();
                                <label for={ i.to_string() } class="flex flex-col">
                                <span>{ input.name.clone() }</span>
                                        ref={ nref }
                                        class="border border-gray-700"
                                        id={ i.to_string() }
                                        placeholder={ input.example.clone() }
                                        disabled={ i == 0 }
                                        oninput={ ctx.link().callback( move |e: InputEvent| {
                                        }) }
@_discord_321674101712224256:t2bot.ioJaro#5648 My problem is that in the update function no matter what index is used it will always print I: <index>, Id: 0 but Id should correspond to the index of the NodeRef 21:53:49
@_discord_321674101712224256:t2bot.ioJaro#5648 * My problem is that in the update function no matter what index is used it will always print I: <index>, Id: 0 but Id should correspond to the index of the NodeRef.
Do you guys have any ideas what could be the culprit?
30 Jan 2023
@_discord_241381897702342656:t2bot.ioRaiwe Is there an example somewhere of a parent component sending a message to a child? 03:07:01
@_discord_241381897702342656:t2bot.ioRaiwe Or vice-versa? 03:07:58
@_discord_241381897702342656:t2bot.ioRaiwe Handling recieving a message through the update function seems simple enough, but I'm not sure how to set them up for the sending side to have a reference to the receiver 03:09:00
@_discord_257231358005477379:t2bot.ioOverloader You should be easily able to send something from child to parent with either callbacks or states and from parent to child I guess with callbacks or a mspc where the receiver has set p a timer to periodically check for new messages? 10:43:24
@_discord_257075425233076224:t2bot.ioSpanishpear outside of props? 11:43:18
@_discord_257075425233076224:t2bot.ioSpanishpear but check the examples in the repo:
- https://github.com/yewstack/yew/tree/master/examples/communication_child_to_parent
- https://github.com/yewstack/yew/tree/master/examples/communication_parent_to_child
@_discord_418420102506217473:t2bot.iofreddy joined the room.12:35:40
@_discord_418420102506217473:t2bot.iofreddy Hi Im trying to find an example of a working hash router example. Haven’t managed to find one in this server or on the docs. Could anyone supply one? 12:35:42
@_discord_418420102506217473:t2bot.iofreddy nvm i figured it out 13:27:55
@_discord_241381897702342656:t2bot.ioRaiwe Yeah, those just have a component's html send a message back to the same component that defined it. I thought the point of messages would be communication between components, but I guess for that you're supposed to use callbacks? 13:36:31

There are no newer messages yet.

Back to Room List