[as] feat: "@hookform/devtools" 추가
This commit is contained in:
@@ -4,6 +4,7 @@ export type { FileAddButtonProps } from "./file-add-button";
|
||||
export { FileAddButton } from "./file-add-button";
|
||||
export { NoData } from "./no-data";
|
||||
export { PageLayout } from "./page-layout";
|
||||
export { RhfDevTool } from "./rhf-devtool";
|
||||
export { SectionCollapsible } from "./section-collapsible";
|
||||
export {
|
||||
SectionCollapsibleGroup,
|
||||
@@ -12,4 +13,4 @@ export {
|
||||
export type { TextShimmerProps } from "./text-shimmer";
|
||||
export { TEXT_SHIMMER_CLASS, TextShimmer } from "./text-shimmer";
|
||||
export type { UploadedFileChipProps } from "./uploaded-file-chip";
|
||||
export { UploadedFileChip } from "./uploaded-file-chip";
|
||||
export { UploadedFileChip } from "./uploaded-file-chip";
|
||||
@@ -0,0 +1,17 @@
|
||||
"use client";
|
||||
|
||||
import type { Control, FieldValues } from "react-hook-form";
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
const DevTool = dynamic(() => import("@hookform/devtools").then((mod) => mod.DevTool), {
|
||||
ssr: false,
|
||||
});
|
||||
|
||||
interface RhfDevToolProps<T extends FieldValues> {
|
||||
control: Control<T>;
|
||||
}
|
||||
|
||||
export function RhfDevTool<T extends FieldValues>({ control }: RhfDevToolProps<T>) {
|
||||
if (process.env.NODE_ENV !== "development") return null;
|
||||
return <DevTool control={control as Control<FieldValues>} placement="top-left" />;
|
||||
}
|
||||
Reference in New Issue
Block a user