You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created a app state in root, and I want to use it in other router. However it has a error about finding None value, which I think is related to my context passing. I'm tired of browsing the relevant documents, so I posted this issue to seek help. The following is my relevant code.
// main.rs#[component]fnApp() -> Element{letmut state = use_signal(|| AppState::new());use_future(move || asyncmove{
state.write().load_articles().await;});provide_context(state);rsx!{
document::Link{ rel:"icon", href:FAVICON}
document::Link{ rel:"stylesheet", href:TAILWIND_CSS}
div {
div {Router::<Route> {}}}}}// router.rs#[derive(Debug,Clone,Routable,PartialEq)]#[rustfmt::skip]pubenumRoute{#[layout(Navbar)]#[route("/")]Home{},#[route("/blog")]Blog{},#[route("/about")]About{},}// blog.rs#[component]pubfnBlog() -> Element{let state = use_context::<Signal<AppState>>();// This seems to be empty
...}
This discussion was converted from issue #4291 on June 18, 2025 12:59.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I created a app state in root, and I want to use it in other router. However it has a error about finding None value, which I think is related to my context passing. I'm tired of browsing the relevant documents, so I posted this issue to seek help. The following is my relevant code.
Beta Was this translation helpful? Give feedback.
All reactions