Hi Team,
we are trying to migrate from UI Kit 1 to latest UI Kit. we are seeing error while integrating the dropdown functionality in our code.
can somebody pls help on this?
requiremnt: the value selected in the dropdown should be printed in the Jira UI
Code:
import React, { useEffect, useState } from ‘react’;
import ForgeReconciler, { Text, Fragment, Form, Select, Option, ButtonSet, Button, Strong, ButtonGroup, Box, Label, FormFooter, FormSection, Stack, useForm } from ‘@forge/react’;
import { invoke } from ‘@forge/bridge’;
const App = () => {
const { getFieldId, register, handleSubmit } = useForm();
const [selectedFruit, setSelectedFruit] = useState(“”);
const onSubmit = (data) => {
setSelectedFruit(data.select); // Update state with selected fruit
};
return (
<>
<Label labelFor={getFieldId(“select”)}>Select
<Select options={[{ label: “Apple”, value: “apple” },
{ label: “Banana”, value: “banana” },]}
{…register(“select”)} />
Cancel
Submit
{selectedFruit && (
You have selected: {selectedFruit}
)}
Hi hellow wowowowsksk
</>);
};
ForgeReconciler.render(
<React.StrictMode>
</React.StrictMode>
);