function useState(x278) {
var
___ =
caml_js_wrap_callback_strict
(1, function (param) { return caml_call1(x278, 0) }),
x279 = Ojs[18].React.useState(___);
function _$_(x280) {
var
_aa_ =
caml_js_wrap_callback_strict
(1, function (x281) { return caml_call1(x280, x281) });
caml_call2(Ojs[16], x279, 1)(_aa_);
return 0
}
return [0, caml_call2(Ojs[16], x279, 0), _$_]
}
This is problematic because every time a new function _$_ is created, which breaks the assumptions of React, where if you do
let data, setData = React.useState (fun () -> 2)
setData should remain constant over time, but I am not sure it's possible as it'd require removing caml_js_wrap_callback_strict. I'm not sure why wrapping is needed for functions that only take 1 param 🤔
The generated code for
useState
is:This is problematic because every time a new function
_$_
is created, which breaks the assumptions of React, where if you dosetData
should remain constant over time, but I am not sure it's possible as it'd require removingcaml_js_wrap_callback_strict
. I'm not sure why wrapping is needed for functions that only take 1 param 🤔