From 8e084d3412215209e66ba9c0047ddaa34c3efc37 Mon Sep 17 00:00:00 2001 From: iamdi Date: Sun, 23 Jun 2019 08:59:25 +1000 Subject: [PATCH] Replace `map` with `forEach` `forEach` is more semantically correct to use in the MultiselectCheckbox example. Codesandbox with `forEach` https://codesandbox.io/s/30-seconds-of-react-multiselectcheckbox-tk9qf --- snippets/MultiselectCheckbox.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/MultiselectCheckbox.md b/snippets/MultiselectCheckbox.md index 496eb6f3b..b335ad37d 100644 --- a/snippets/MultiselectCheckbox.md +++ b/snippets/MultiselectCheckbox.md @@ -23,7 +23,7 @@ function MultiselectCheckbox({ options, onChange }) { const [data, setData] = React.useState(options); const toggle = item => { - data.map((_, key) => { + data.forEach((_, key) => { if (data[key].label === item.label) data[key].checked = !item.checked; }); setData([...data]);