let numbers = [1, 5, 6, 12, 52, 25];
let state: list((int, bool)) = numbers |> List.map(n => (n, false));
state |> List.map((n, b) => <NumberCard number=n picked=b onClick />);
因为类型检查器报错,可能是什么问题呢:
51 ┆
52 ┆ let elems =
53 ┆ state |> List.map((n, b) => <NumberCard number=n picked=b onClick />
);
54 ┆
55 ┆ <div className="flex flex-column">
This has type:
list(int) => list(bool => React.element)
But somewhere wanted:
list((int, bool)) => 'a
The incompatible parts:
int
vs
(int, bool)