Skip to content
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

How to handle this warning and this situation? <Create> was created with unknown prop 'playerID' #54

Open
frederikhors opened this issue Jul 22, 2022 · 0 comments

Comments

@frederikhors
Copy link

I'm using svelte-loadable and the below code but I'm getting the below warning and I feel this is not a good code.

Can you suggest me how to properly handle this?

The warning: <Create> was created with unknown prop 'playerID'

The code:

<script lang="ts">
	import Loadable from "svelte-loadable";
  
  export let loader: string;
  // other code
</script>

<Loadable
  loader={loader === "player"
    ? () => import("$lib/../routes/players/create.svelte")
    : () => import("$lib/../routes/teams/create.svelte")
    // others here...
  }
  let:component
>
  <svelte:component
    this={component}
    {formName}
    on:SOMETHING={handleSOMETHING}
    {/* other props here */}
    playerID={loader === "player" ? playerID : undefined}
  />
</Loadable>

Is there a way I can avoid the playerID prop based on which component I'm loading?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant