HOW to use Dioxus Components? #5354
hyxdxhb123
started this conversation in
General
Replies: 1 comment 1 reply
-
|
The errors are quite specific and clear:
In your code, you are using |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
-
How to use Dioxus components? When I use the demo code
`// demo.rs
use super::super::component::;
use dioxus::prelude::;
#[component]
pub fn Demo() -> Element {
rsx! {
div { display: "flex", flex_direction: "column", gap: "0.5rem",
Button { "Primary" }
}`
, my VSCode displays the following issues/problems:
[{ "resource": "/f:/rust_prjs/hot_dog/src/main.rs", "owner": "rustc", "code": { "value": "Click for full compiler diagnostic", "target": { "$mid": 1, "path": "/diagnostic message [0]", "scheme": "rust-analyzer-diagnostics-view", "query": "0", "fragment": "file:///f%3A/rust_prjs/hot_dog/src/main.rs" } }, "severity": 8, "message": "cannot find valuevariantin moduledioxus_elements::button\nnot found indioxus_elements::button", "source": "rustc", "startLineNumber": 14, "startColumn": 22, "endLineNumber": 14, "endColumn": 29, "modelVersionId": 141, "origin": "extHost1" },{ "resource": "/f:/rust_prjs/hot_dog/src/main.rs", "owner": "rustc", "code": { "value": "Click for full compiler diagnostic", "target": { "$mid": 1, "path": "/diagnostic message [4]", "scheme": "rust-analyzer-diagnostics-view", "query": "4", "fragment": "file:///f%3A/rust_prjs/hot_dog/src/main.rs" } }, "severity": 8, "message": "failed to resolve: use of undeclared typeButtonVariant\nuse of undeclared typeButtonVariant", "source": "rustc", "startLineNumber": 14, "startColumn": 31, "endLineNumber": 14, "endColumn": 44, "modelVersionId": 141, "origin": "extHost1" },{ "resource": "/f:/rust_prjs/hot_dog/src/main.rs", "owner": "rustc", "code": { "value": "Click for full compiler diagnostic", "target": { "$mid": 1, "path": "/diagnostic message [1]", "scheme": "rust-analyzer-diagnostics-view", "query": "1", "fragment": "file:///f%3A/rust_prjs/hot_dog/src/main.rs" } }, "severity": 8, "message": "cannot find valuevariantin moduledioxus_elements::button\nnot found indioxus_elements::button", "source": "rustc", "startLineNumber": 16, "startColumn": 22, "endLineNumber": 16, "endColumn": 29, "modelVersionId": 141, "origin": "extHost1" },{ "resource": "/f:/rust_prjs/hot_dog/src/main.rs", "owner": "rustc", "code": { "value": "Click for full compiler diagnostic", "target": { "$mid": 1, "path": "/diagnostic message [5]", "scheme": "rust-analyzer-diagnostics-view", "query": "5", "fragment": "file:///f%3A/rust_prjs/hot_dog/src/main.rs" } }, "severity": 8, "message": "failed to resolve: use of undeclared typeButtonVariant\nuse of undeclared typeButtonVariant", "source": "rustc", "startLineNumber": 16, "startColumn": 31, "endLineNumber": 16, "endColumn": 44, "modelVersionId": 141, "origin": "extHost1" },{ "resource": "/f:/rust_prjs/hot_dog/src/main.rs", "owner": "rustc", "code": { "value": "Click for full compiler diagnostic", "target": { "$mid": 1, "path": "/diagnostic message [2]", "scheme": "rust-analyzer-diagnostics-view", "query": "2", "fragment": "file:///f%3A/rust_prjs/hot_dog/src/main.rs" } }, "severity": 8, "message": "cannot find valuevariantin moduledioxus_elements::button\nnot found indioxus_elements::button", "source": "rustc", "startLineNumber": 18, "startColumn": 22, "endLineNumber": 18, "endColumn": 29, "modelVersionId": 141, "origin": "extHost1" },{ "resource": "/f:/rust_prjs/hot_dog/src/main.rs", "owner": "rustc", "code": { "value": "Click for full compiler diagnostic", "target": { "$mid": 1, "path": "/diagnostic message [6]", "scheme": "rust-analyzer-diagnostics-view", "query": "6", "fragment": "file:///f%3A/rust_prjs/hot_dog/src/main.rs" } }, "severity": 8, "message": "failed to resolve: use of undeclared typeButtonVariant\nuse of undeclared typeButtonVariant", "source": "rustc", "startLineNumber": 18, "startColumn": 31, "endLineNumber": 18, "endColumn": 44, "modelVersionId": 141, "origin": "extHost1" },{ "resource": "/f:/rust_prjs/hot_dog/src/main.rs", "owner": "rustc", "code": { "value": "Click for full compiler diagnostic", "target": { "$mid": 1, "path": "/diagnostic message [3]", "scheme": "rust-analyzer-diagnostics-view", "query": "3", "fragment": "file:///f%3A/rust_prjs/hot_dog/src/main.rs" } }, "severity": 8, "message": "cannot find valuevariantin moduledioxus_elements::button\nnot found indioxus_elements::button", "source": "rustc", "startLineNumber": 20, "startColumn": 22, "endLineNumber": 20, "endColumn": 29, "modelVersionId": 141, "origin": "extHost1" },{ "resource": "/f:/rust_prjs/hot_dog/src/main.rs", "owner": "rustc", "code": { "value": "Click for full compiler diagnostic", "target": { "$mid": 1, "path": "/diagnostic message [7]", "scheme": "rust-analyzer-diagnostics-view", "query": "7", "fragment": "file:///f%3A/rust_prjs/hot_dog/src/main.rs" } }, "severity": 8, "message": "failed to resolve: use of undeclared typeButtonVariant\nuse of undeclared typeButtonVariant", "source": "rustc", "startLineNumber": 20, "startColumn": 31, "endLineNumber": 20, "endColumn": 44, "modelVersionId": 141, "origin": "extHost1" }]here are my code
`
use dioxus::prelude::*;
fn main() {
dioxus::launch(App);
}
#[component]
fn App() -> Element {
rsx! {
div { display: "flex", flex_direction: "column", gap: "0.5rem",
button { "Primary" }
}
`
Beta Was this translation helpful? Give feedback.
All reactions