Become a member
to unlock all features

Create egghead account to access 1,000+ tutorials and resources from expert developers.

Create account

    Use reactive declarations to compute component state in Svelte 3


    Svelte automatically updates the DOM when your component's state changes. Often, some parts of a component's state need to be computed from other parts. This is where reactive declarations come in.

    In this lesson we are going to learn how to use reactive declarations to re-compute (and render) square of a counter value in a simple counter example whenever user clicks on a button.