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

How to pass a component as a prop in another component in svelte

$
0
0

I have 2 components - Slider Component and Button Component

Following is the Button component

<script>  export button_type, custom_class, clickHander;</script><button type={button_type} class= "{custom_class} on:click="{clickHandler}"<span>{buttonType.button_text}</span></button>

I am using the above Button component in Slider Component

<script>import Button from './file_path'</script><div><h1>I am slider</h1><Button /></div>

My objective is to use this Slider component in the App.svelte (root) and pass the props to Button from App.svelte

How can I achieve this?


Viewing all articles
Browse latest Browse all 1541

Trending Articles



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