Skip to content

Commit

Permalink
🔨 그룹명 useController 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
ttaerrim committed Feb 1, 2024
1 parent 70709fa commit 65a6c02
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions app/frontend/src/pages/Groups/Create/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useForm } from 'react-hook-form';
import { useController, useForm } from 'react-hook-form';

import { TextLabel, Button } from '@morak/ui';

Expand All @@ -22,13 +22,27 @@ export function GroupCreatePage() {
mode: 'all',
});

const {
field: { value: nameValue, onChange: onChangeName },
} = useController({
name: 'name',
control,
rules: {
required: true,
},
});
return (
<form
className={styles.container}
// TODO: POST 요청
onSubmit={handleSubmit((data) => console.log(data))}
>
<FormInput label="그룹명" required />
<FormInput
label="그룹명"
required
value={nameValue}
onChange={onChangeName}
/>
<div className={styles.inputWrapper}>
<TextLabel label="그룹 유형" required />
<GroupTypeRadio control={control} />
Expand Down

0 comments on commit 65a6c02

Please sign in to comment.