Passing props and undefined is not a constructor

Just wiring up basic props and getting an error.

In Component.svelte file:

<script>
    import { Foo } from './Foo.svelte'
</script>

   <Foo number={42}/>

In Foo.svelte:

<script>
   export let number;
</script>

Number is {number}

I get the following error in the console:

TypeError: undefined is not a constructor (evaluating 'new Foo({
    props: {
      number: 42
    },
    $$inline: true
  })')

Wondering what I’m missing here. Thanks for any guidance!

Remove the brackets in the import, so:

import Foo from './Foo.svelte';
3 Likes

:pray:t2: Saved me so much time. Works now. Thank you for the help!!

1 Like