-
-
Notifications
You must be signed in to change notification settings - Fork 252
Syntax lookup: add ref value assignment documentation #206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
id: "ref-assignment" | ||
keywords: ["ref", "assign"] | ||
name: ":=" | ||
summary: "This is the `ref assignment` operator." | ||
illusionalsagacity marked this conversation as resolved.
Show resolved
Hide resolved
|
||
category: "operators" | ||
--- | ||
|
||
This operator is syntactic sugar for assigning to the `contents` value of a `ref` | ||
illusionalsagacity marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually no sugar provided for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gotcha, I was essentially quoting from pages/docs/manual/latest/mutation.mdx:
Should I re-work this language as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added some comments. I think it's not important how this is implemented, we should just describe what it does and how it is useful. |
||
<CodeTab labels={["ReScript", "JS Output"]}> | ||
|
||
```res | ||
let total = ref(0) | ||
total := 1 | ||
``` | ||
|
||
```js | ||
var total = { | ||
contents: 0 | ||
}; | ||
|
||
total.contents = 1; | ||
``` | ||
|
||
illusionalsagacity marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</CodeTab> |
Uh oh!
There was an error while loading. Please reload this page.