Skip to content

Commit 7b05602

Browse files
author
rob
committed
docs: add ref assignment documentation
1 parent fcc69db commit 7b05602

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
id: "ref-assignment"
3+
keywords: ["ref", "assign"]
4+
name: ":="
5+
summary: "This is the `ref assignment` operator."
6+
category: "operators"
7+
---
8+
9+
This operator is syntactic sugar for assigning to the `contents` value of a `ref`
10+
11+
<CodeTab labels={["ReScript", "JS Output"]}>
12+
13+
```res
14+
let total = ref(0)
15+
total := 1
16+
```
17+
18+
```js
19+
var total = {
20+
contents: 0
21+
};
22+
23+
total.contents = 1;
24+
```
25+
26+
</CodeTab>

0 commit comments

Comments
 (0)