import { useEffect } from "react"; import { Meta, StoryObj } from "@storybook/react"; import { Select } from "./Select"; import { useForm } from "react-hook-form"; import { action } from "@storybook/addon-actions"; const meta: Meta = { title: "Components / Select", component: Select, }; export default meta; type Story = StoryObj; const SelectTemplate: Story = { render: (args) => { const { control, watch, setError } = useForm(); const name = "selectField"; if (args.error) { setError(name, { message: "Error message" }); } useEffect(() => { const subscription = watch((value) => action("[React Hooks Form] Form value changed")(value)); return () => subscription.unsubscribe(); }, [watch]); return (