blob: 46399a239f51f262660a68614eb329d9eb0ca5a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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);
};
};
|