Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

Svelte showing warning for creating an app with unknown prop

$
0
0

I have a very basic Svelte app where I am displaying some super simple HTML, just starting.In my dev tools console, though I see the following warning:

<App> was created with unknown prop 'name'

Why? This is my code in app.svelte:

<script>  import Modal from "./modal.svelte"  import Product from "./product.svelte"  const products = [    {      id: "1",      productTitle: "Product Title 1",      productPrice: 111.11,    },    {      id: "2",      productTitle: "Product Title 2",      productPrice: 222.22,    },  ]  let showModal = false  const addToCart = e => {    console.log(e.detail)  }  const deleteFromCart = e => {    console.log(e.detail)  }</script>{#each products as product (product.id)}<Product {...product} on:add-to-cart={addToCart} on:delete={deleteFromCart} />{/each}<button on:click={() => (showModal = true)}>Show Modal</button>{#if showModal}<Modal><h1 slot="header">Hi!</h1><p>This works!</p><button slot="footer">Confirm</button></Modal>{/if}

When I expand the warning in the dev tools console it tells me I am missing this name prop on line 24 in app.svelte where I actually have a console.log statement.


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>