Skip to content

Commit

Permalink
Don't mention the use of [%mel.obj] extension for creating Js.t obj…
Browse files Browse the repository at this point in the history
…ects when in reasonml mode
  • Loading branch information
feihong committed Jan 7, 2025
1 parent 98722f8 commit f4138e8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docs/working-with-js-objects-and-values.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,13 @@ advance, which can be helpful for prototyping or quickly generating JavaScript
object literals.

Melange provides some ways to create `Js.t` object values, as well as accessing
the properties inside them. To create values, the `[%mel.obj]` extension is
used, and the `##` infix operator allows to read from the object properties:
the properties inside them.

- To create values, use the <span class="text-ocaml">`[%mel.obj]` extension
enclosing a record</span><span class="text-reasonml">`{ "key1": value1,
"key2": value2, ... }` syntax (note that the names of keys must be surrounded
by double quotes)</span>
- To access object properties, use the `##` infix operator.

```ocaml
let john = [%mel.obj { name = "john"; age = 99 }]
Expand Down

0 comments on commit f4138e8

Please sign in to comment.