question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rendered together routes with parameters and chars

See original GitHub issue

Using this:

<Route path="/player/new">
  <New />
</Route>
<Route path="/player/:playerID" let:params>
  <Show playerID={params.playerID} />
</Route>

or this:

<Route path="/player/*">
  <Route path="/new">
    <New />
  </Route>
  <Route path="/:playerID" let:params>
    <Show playerID={params.playerID} />
  </Route>
</Route>

it renders /player/new and /player/123 together.

Expected

It should render <New /> if I’m on /player/new and <Show /> if I’m on /player/* (everything is not /player/new).

Am I wrong?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:19 (19 by maintainers)

github_iconTop GitHub Comments

1reaction
AlexxNBcommented, Apr 28, 2020

Yeah, you should use /#/page notation for Links in REPL. Because REPL has own handler for all links inside.

0reactions
AlexxNBcommented, May 2, 2020

Nope, router store is not why tinro works. It is just URL changing handler. You have only this choices at the moment:

  1. Do not use <Route> inside lazyloaded component. Consider to change your architecture:

Before:

<!-- Mypage.svelte -->
I'm the page
<Route path="/page1"><Lazy cmp={import('./Page1.svelte)}/></Route>
<Route path="/page2"><Lazy cmp={import('./Page2.svelte)}/></Route>

<!-- App.svelte -->
<Route>
    <Lazy cmp={import('./Mypage.svelte)}/>
</Route> 

After:

<!-- Pageroot.svelte -->
I'm the page

<!-- Mypage.svelte -->
<Lazy cmp={import('./Pageroot.svelte)} />
<Route path="/page1"><Lazy cmp={import('./Page1.svelte)} /></Route>
<Route path="/page2"><Lazy cmp={import('./Page2.svelte)} /></Route>

<!-- App.svelte -->
<Route>
    <Mypage />
</Route> 
  1. Choose different router from the list.
Read more comments on GitHub >

github_iconTop Results From Across the Web

About Routing with Express. We look at special characters ...
Placeholders for route parameters are specified by using a colon in front of the placeholder name. We call next to chain multiple route...
Read more >
React Router DOM: How to handle routing in web apps
React Router DOM contains the DOM bindings for React Router. Learn about its essential components and how to build routes with parameters.
Read more >
How to enforce presence of searchParams on react-router-v6 ...
Only the path is used by react-router-dom Route components. Use the useSearchParams hook in the matched/routed component and check for the page ...
Read more >
Match - React Router: Declarative Routing for React.js
A match object contains information about how a <Route path> matched the URL. match objects contain the following properties: params - (object) Key/value ......
Read more >
Express Tutorial Part 4: Routes and controllers - MDN Web Docs
Route parameters are named URL segments used to capture values at specific positions in the URL. The named segments are prefixed with a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found