React-hook-form and Semantic-UI Dropbox

Viewed 1096
const categories = { value: "strawberry", label: "Strawberry" };


<Controller
              name="majorCategory"
              as={
                <Form.Dropdown selection options={categories} error={!!errors.majorCategory} />
              }
              control={control}
              rules={{ required: true }}
              onChange={([selected]) => {
                console.log(selected); // console
                return { value: selected };
              }}
              defaultValue={{}}
              valueName="selected"
            />

I made a dropdown of semantic-ui. I want to get a selected value but console doesn't show selected value. It just returns a big object. How am I supposed to implement dropdown to get a selected value? I want to keep using controller anyway.

0 Answers
Related