Mutability

In this lesson, we'll make a mutable let variable using the ref() wrapper.

We'll cover the following

We’ve already observed how normal let binding variables are immutable. One approach was to redefine the binding with a new value.

However, there is an actual way to make let bindings mutable!

The ref() Wrapper

In order to achieve mutability, the value being assigned to a variable must be enclosed in a ref() wrapper. To assign a new value, we must use the := operator:

Get hands-on with 1200+ tech skills courses.