{"record":{"id":"d4b3e3440f82db73","repo":"DioxusLabs/dioxus","slug":"const-components-are-not-supported","errorCode":null,"errorMessage":"Const components are not supported","messagePattern":"Const components are not supported","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"packages/core-macro/src/component.rs","lineNumber":485,"sourceCode":"    // 2. make sure there's no lifetimes on the component - we don't know how to handle those\n    if item_fn.sig.generics.lifetimes().count() > 0 {\n        return Err(Error::new(\n            item_fn.sig.generics.span(),\n            \"Lifetimes are not supported in components\".to_string(),\n        ));\n    }\n\n    // 3. we can't handle async components\n    if item_fn.sig.asyncness.is_some() {\n        return Err(Error::new(\n            item_fn.sig.asyncness.span(),\n            \"Async components are not supported\".to_string(),\n        ));\n    }\n\n    // 4. we can't handle const components\n    if item_fn.sig.constness.is_some() {\n        return Err(Error::new(\n            item_fn.sig.constness.span(),\n            \"Const components are not supported\".to_string(),\n        ));\n    }\n\n    // 5. no receiver parameters\n    if item_fn\n        .sig\n        .inputs\n        .iter()\n        .any(|f| matches!(f, FnArg::Receiver(_)))\n    {\n        return Err(Error::new(\n            item_fn.sig.inputs.span(),\n            \"Receiver parameters are not supported\".to_string(),\n        ));\n    }\n","sourceCodeStart":467,"sourceCodeEnd":503,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/core-macro/src/component.rs#L467-L503","documentation":"Validation 4 in validate_component_fn: the #[component] fn is declared const. Const fns are not valid component bodies for the macro's generated code; the faulting input is the const fn declaration, which must drop the const qualifier.","triggerScenarios":"Thrown at packages/core-macro/src/component.rs:485 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the `const` qualifier from the component function; Dioxus components must be plain (non-const) functions."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}