diff options
author | polwex <polwex@sortug.com> | 2025-06-15 01:44:45 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-06-15 01:44:45 +0700 |
commit | 69312f5133734237edaea6ca29e2de9bf3203050 (patch) | |
tree | 7fee98735e5701cacb4aba87cfd307f0e1fb505a /bs5/universal/native/shared/RR.re | |
parent | f13574dc6661dba88a64580942f0c62cd42f63d7 (diff) |
checkpoint here...
Diffstat (limited to 'bs5/universal/native/shared/RR.re')
-rw-r--r-- | bs5/universal/native/shared/RR.re | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/bs5/universal/native/shared/RR.re b/bs5/universal/native/shared/RR.re new file mode 100644 index 0000000..46399a2 --- /dev/null +++ b/bs5/universal/native/shared/RR.re @@ -0,0 +1,21 @@ +[@platform native] +include { + let useStateValue = initialState => { + let setValueStatic = _newState => (); + (initialState, setValueStatic); + }; + }; + +[@platform js] +include { + [@mel.module "react"] + external useState: + (unit => 'state) => ('state, (. ('state => 'state)) => unit) = + "useState"; + + let useStateValue = initialState => { + let (state, setState) = useState(_ => initialState); + let setValueStatic = newState => setState(. _ => newState); + (state, setValueStatic); + }; + }; |