0

I stared to experiment with https://github.com/gbj/leptos/ using the current main branch from Git. Following the router example I get the following warning in my console in the browser:

WARNING: You are providing a context of a type (leptos_reactive::memo::Memo<leptos_router::components::routes::RouterState>)that's already been provided higher in the context tree. If this is unintentional, there's a chance it will cause bugs, because the value of the context is now 'shadowed' in the lower parts of the tree.

I understand the message, but I have no idea what I'm doing wrong. My router component looks like this:

#[component]
pub fn Playground(
  cx: Scope,
) -> impl IntoView {

  view! { cx,
      <Router>                                                                                                                                 
          <nav>                                                                                                                                
              <A exact=true href="/">"Simple"</A>                                                                                              
              <A href="demo1">"Demo 1"</A>                                                                                                     
              <A href="demo2">"Demo 2"</A>                                                                                                     
          </nav>                                                                                                                               
          <main>                                                                                                                               
              <Routes>                                                                                                                         
                  <Route                                                                                                                       
                      path="/"                                                                                                                 
                      view=move |cx| view! { cx, <SimpleComponent/> } />                                                                       
                  <Route                                                                                                                       
                      path="demo1"                                                                                                             
                      view=move |cx| view! { cx, <Demo1 /> } />                                                                                
                  <Route                                                                                                                       
                      path="demo2"                                                                                                             
                      view=move |cx| view! { cx, <Demo2 /> } />
              </Routes>
          </main>
      </Router>
  }
}
1
  • ... error: cannot find attribute 'component' in this scope and many more. Are we supposed to gess where all these types come from? Commented Jan 1, 2023 at 1:17

1 Answer 1

1

If I recall correctly you found your way to our Discord. Basically this is an over-zealous warning I added a couple days ago in our main branch but probably need to revert.

In general I’d probably discourage asking questions that are so specific to particular libraries on Stack Overflow, especially when it’s a smallish and new library.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.