Svelte: Variables

Define variables in your <script> tag and then use it with brackets:

<script>
  let foo = "bar"
</script>
<p class={bar}>Some text</p>

Tip: It also works inside double-quotes: <p class="primary-{bar}">Some text</p>

Moreover, when var = attribute, (src={src}) you can use it this way: {src}.