Skip to content

An error gets printed when calling VirtualDom::new_with_props #3872

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

Open
MintSoup opened this issue Mar 14, 2025 · 0 comments · May be fixed by #3911
Open

An error gets printed when calling VirtualDom::new_with_props #3872

MintSoup opened this issue Mar 14, 2025 · 0 comments · May be fixed by #3911
Assignees
Labels
bug Something isn't working core relating to the core implementation of the virtualdom

Comments

@MintSoup
Copy link
Contributor

Problem

Calling VirtualDom::new_with_props prints out the following error:

ERROR It looks like you called the component <the component> like a function instead of a component. Components should be called with braces like <the component> { prop: value } instead of as a function

Here's a code example:

use dioxus::{
    desktop::{wry::dpi::Size, Config, WindowBuilder},
    prelude::*,
};

fn main() {
    dioxus::launch(App);
}

#[component]
fn App() -> Element {
    rsx! {
        Hero {}
    }
}

#[component]
pub fn Component(sig: Signal<Vec<i32>>) -> Element {
    rsx! {
        "Component"
    }
}

#[component]
pub fn Hero() -> Element {
    let sig = use_signal(Vec::<i32>::new);
    rsx! {
        button {
            onclick: move |_| {
                dioxus::desktop::window().new_window(
                    VirtualDom::new_with_props(Component, ComponentProps { sig } ),
                    Config::default(),
                );
            }
        }
    }
}

Strangely enough though the app itself seems to work fine.

Environment:

  • Dioxus version: 0.6.3
  • Rust version: 1.85
  • OS info: Arch
  • App platform: desktop

Questionnaire
I'm interested in fixing this myself but don't know where to start.

@MintSoup MintSoup added the bug Something isn't working label Mar 14, 2025
@ealmloff ealmloff self-assigned this Mar 25, 2025
@ealmloff ealmloff added the core relating to the core implementation of the virtualdom label Mar 25, 2025
@ealmloff ealmloff linked a pull request Mar 25, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core relating to the core implementation of the virtualdom
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants