I've just started learning svelte in the last hour so forgive me if this question is stupid or already answered. I tried searching but I don't even know the parlance to ask the question well.
Based on this svelte.dev tutorial link on spread props, my question is as follows.
How do I modify this to be something like this code.
<script>
import Info from './Info.svelte';
const pkg = {
name: 'svelte',
version: 3,
speed: 'blazing',
website: 'https://svelte.dev',
// this is the modification
npm: 'https://www.npmjs.com/package/' + {name},
// I've also tried:
npm: 'https://www.npmjs.com/package/{name}',
};
</script>
<Info {...pkg}/>
This is the other modified file.
<script>
export let name;
export let version;
export let speed;
export let website;
export let npm;
</script>
<p>
The <code>{name}</code> package is {speed} fast.
Download version {version} from <a href={npm}>npm</a>
and <a href={website}>learn more here</a>
</p>
I'm trying to use a prop in the declaration of another prop exported from the same component.
Seems like it's easy but I'm missing something.
**** Edit *****
Based on Thomas Hennes answer I realized I had the foundation of the question wrong. What I needed to understand was the control flow structure of Svelte, which rendered this formulation redundant. I had a flawed model of a component as some sort of function that took inputs and could also return outputs that could be used in other components. But I'm starting to understand (I think) that it's more just a top-down inheritance model maybe.
TL:DR, Konrads answer was technically correct based on my actual question, but Thomas Hennes answer helped me the most.