It’s hard to tell because the forum messed up the formatting a bit. In the future you can wrap code that has backticks in it it with a ~~~
before and after the code:
~~~
like this
~~~
I think that what you have now is
```js
const x = view(Inputs.range());
console.log("x", x);
const x2 = 2 * x;
```
Here is x: ${x}. Here is x2: ${x2}
Observable’s reactive updates only work between blocks. When one of the outputs of a block changes, any dependent blocks will re-run. Since x2
is defined in the same block as x
, it isn’t re-computed when x
changes.
Instead, you should use something like
```js
const x = view(Inputs.range());
```
```js
const x2 = 2 * x;
```
Here is x: ${x}. Here is x2: ${x2}
Because x2
is in a separate block than x
, it will receive reactive updates.