An example of a reusable form component / 再利用可能なフォームコンポーネントの例 / 一個可重複使用的表單元件範例 #4367
Arce0406
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Intro
【EN】
Shadcn-ui is a great collection of components, but since I am not that familiar with react, I was very troubled when I first started using the form component and could not understand the docs on shadcn-ui and react-hook-form.
Until now I have wrote a simple reusable form component, so I want to share it, and if there is any better ways, please teach me.
The following examples are based on Next.js 13 and TypeScript.
【JP】
Shadcn-ui は素晴らしいコンポーネントのコレクションですが、私は React にあまり詳しくないため、最初に form コンポーネントを使い始めたとき、shadcn-ui と React-Hook-form のドキュメントが理解できずに非常に苦労しました。
今まで簡単な再利用可能なフォームコンポーネントを書いたので共有したいと思います、そしてもっと良い方法があれば教えてください。
次の例は、Next.js 13 と TypeScript に基づいています。
【CH】
Shadcn 是個很棒的元件集合,但由於我自己對於 react 並不是那麼的熟悉,所以剛開始使用 form 元件時感到非常困擾,完全看不懂 shadcn 與 react-hook-form 上的教學文件。
直到今天我才研究出了一個簡單的可重複使用範本,因此想分享出來,並且如果有更好的優化方式,還請傳授與我。
以下範例是基於 Next.js 13、TypeScript 語法。
Example
Result
ShadcnForm.tsx
SampleForm.tsx
Beta Was this translation helpful? Give feedback.
All reactions