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] 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 {( + + )} + })} );