again: <component> was created with unknown prop 'params'
See original GitHub issueIt seems that this bug is not fully fixed: https://github.com/ItalyPaleAle/svelte-spa-router/issues/83
404-Components still have this issue for me
import NotFound from '../views/404.svelte'
const routes = {
...
'*': NotFound, //<<<<<<<
}
...
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (9 by maintainers)
Top Results From Across the Web
Passing props down in Svelte - Stack Overflow
With svelte-routing, you don't pass props from the <Link> component, you pass them from the <Route> component implicitly.
Read more >Useful Patterns by Use Case - React TypeScript Cheatsheets
Usecase: you want to make a <Button> that takes all the normal props of ... then you can use ComponentPropsWithRef to grab props...
Read more >History - React Router: Declarative Routing for React.js
Therefore it is recommended to access the location from the render props of <Route> , not from history.location . This ensures your assumptions...
Read more >Troubleshooting | React Navigation
Here, every time the component re-renders, a new function will be created and passed to the component prop. React will see a new...
Read more >How to Use React Router in Typescript | Pluralsight
We'll start by creating an empty application using Create React App ... parameter, so in order to use it, we spread the component...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is a good point but it’s not something I can fix.
First, please note that it’s just a warning that Svelte (not the router) emits, so: it won’t break your app, and it’s not something we can disable.
The fix for #83 consisted in passing the
params
prop only if there’s a match in the path. That is, if your path is a fixed one (such as/hello/world
) then there’s nothing matched, so the router doesn’t pass anything to the route. If there’s anything that would create a match, then it’s passed.In the case of the
*
route, the router does create aparams.wild
prop, which matches the page that wasn’t found. And that’s passed to the component.There’s not much we can do there. It’s not possible for a Svelte component to inspect another Svelte component and check if it exposes any prop (that is only possible if Svelte components are compiled as “custom elements” per https://svelte.dev/docs#Custom_element_API ).
You can only adopt a workaround, which can be one of:
NotFound
component, expose theparams
prop:export let params = {}
. You don’t need to use that prop at all, but it being there will disable the warning.I understand this is not ideal, but sadly this is not something we can change as it’s how Svelte works.
I opened this: https://github.com/sveltejs/svelte/issues/4652.
We’ll see.