-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
was created with unknown prop 'location' #122
Comments
Can you put the app in repl or codesandbox so we can reproduce the error and try fo fix it ? |
Basically I just follow the instruction created a svelte app and install the svelte-routing lib, and copy past. maybe just leave it alone or use |
I get this warning if I do: |
In the About component add: |
Hi @ligrant! You get this warning because the <svelte:component this="{component}" location={$location} {...routeParams} {...routeProps} /> This is so that you can make use of the location information in your component: <!-- App.svelte -->
<Route path="blog" component="{Blog}" />
<!-- Blog.svelte -->
<script>
import queryString from "query-string";
export let location;
let queryParams;
$: queryParams = queryString.parse(location.search);
</script>
<h1>Blog</h1>
<p>{queryParams.foo}</p> This sadly means that you get a warning if you are not using the passed in The |
@EmilTholin I obviously have the same issue but was thinking that since the I'm not super familiar with <!-- Blog.svelte -->
<script>
import { location } from 'svelte-routing';
import queryString from "query-string";
let queryParams;
$: queryParams = queryString.parse($location.search);
</script>
<h1>Blog</h1>
<p>{queryParams.foo}</p> EDIT: Interestingly I've just seen that svelte-spa-router does as I'm suggesting for both |
PS use URLSearchParams instead of query-string |
Also getting this here https://github.com/quantuminformation/svelte-firebase-starter
|
hey, @EmilTholin this package becoming popular. you should fix all of the bugs. I saw that the latest version is a year ago. please fix the bug |
I'm having the same exact issue. |
was created with unknown prop 'location' same error here when use |
@EmilTholin What is the solution to this problem? If we don't use If we do use This works in some cases:
But it does not work when you have parameters:
Property 'foo' is missing in type '{}' but required in type '{ foo: any; }'.js(2741) |
Hi |
Svelte Routing v1.8.0 released. |
If use:
<Route exact path="about"><About /></Route>
All good.
If use:
<Route exact path="about" component={About} />
About.svelte:14 was created with unknown prop 'location'
About.svelte:14 was created with unknown prop 'exact'
Any ideal?
"svelte": "^3.20.1"
"svelte-routing": "^1.4.2"
The text was updated successfully, but these errors were encountered: