From 4ba197354eb5bfd173c3c1d7ba4ea113500ae1fc Mon Sep 17 00:00:00 2001 From: cinderblockgames <79210192+cinderblockgames@users.noreply.github.com> Date: Thu, 18 Nov 2021 22:25:28 -0500 Subject: [PATCH 1/2] Switching from `select defaultValue` to `option selected`. --- src/components/select.tsx | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/components/select.tsx b/src/components/select.tsx index e77a4b4..1bf0754 100644 --- a/src/components/select.tsx +++ b/src/components/select.tsx @@ -32,17 +32,27 @@ const Select = ({ data-testid={"select" + (testId ? "-" + testId : "")} onChange={(e) => update(items, onChange, e)} className={className} - defaultValue={current} > - {items.map(({ label, value }, index) => ( - - ))} + {items.map(({ label, value }, index) => { + if (label === current) {( + + )} else {( + + )} + })} ); From 0f4923029aa14c4ceeea97aaf530dd3d9c70145d Mon Sep 17 00:00:00 2001 From: cinderblockgames <79210192+cinderblockgames@users.noreply.github.com> Date: Thu, 18 Nov 2021 22:29:24 -0500 Subject: [PATCH 2/2] has to be returned --- src/components/select.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/select.tsx b/src/components/select.tsx index 1bf0754..5fe7cc4 100644 --- a/src/components/select.tsx +++ b/src/components/select.tsx @@ -34,8 +34,8 @@ const Select = ({ className={className} > {items.map(({ label, value }, index) => { - if (label === current) {( - - )} else {( - - )} + } })} );