You can use the Map
module from Core
.
let t: Map.t<string, string> = Map.make()
let add = (key: string, value: string) => {
t->Map.set(key, value)
}
let x = add("foo", "bar")
Console.log(t->Map.get("foo")) // => "bar"
https://rescript-lang.org/docs/manual/v11.0.0/api/core/map#value-set