Skip to content

Typescript error for options prop #5049

Answered by Methuselah96
brunolsantos asked this question in Q&A
Discussion options

You must be logged in to vote

That's because the value prop needs to take an option not a function. Maybe this is what you're trying to do? Note that getSelectedValue would need to return a DropdownOption.

        {dropdowns &&
          dropdowns.map((item) => {
            return (
              <Select
-               value={() => getSelectedValue(item.id)}
+               value={getSelectedValue(item.id)}
                options={item.options}
                onChange={(selectedOption) => {
                  setSelectedItemToState(selectedOption);
                }}
              />
            );
          })}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@brunolsantos
Comment options

Answer selected by brunolsantos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants