Reactivity with sveltestrap components

This is clearly a svelte newbie question, but I don’t understand why a component doesn’t update the content in a slot …

Let me explain: I am trying to use sveltestrap and re-create the simple button click.

This is what my App.svelte looks like

<script>
  import {
    Button,
 } from 'sveltestrap';

let counter = 0;

function buttonClick(){
 counter++
}
<script>

<Button on:click={buttonClick}>{counter}</Button> counter={counter}

The counter gets updated when clicking the button, but I would expect the button text to also get updated, but it doesn’t. Where am I going wrong here?

I haven’t used sveltestrap but reactivity should be triggered this way:

function buttonClick(){
 counter = counter++
}

I can reproduce the issue, but couldnt fix it. I am not that familiar with the sveltestrap package

have you seen this library? https://sveltematerialui.com/ it looks nice

I posted issue 146 on sveltestrap github

1 Like