Skip to content

Commit

Permalink
[fe] refactor (#95) InputIdPw 컴포넌트 리팩토링
Browse files Browse the repository at this point in the history
- handleSubmit을 useCallback으로 변경
- 번호와 이름을 비구조화 할당으로 변경
  • Loading branch information
GrasshopperBears committed Dec 14, 2020
1 parent fe7de68 commit b18cbb3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/src/components/userSignup/InputIdPw.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ const InputIdPw: React.FC<InputIdPwProps> = (props) => {
});
const [addUser] = useMutation(ADD_USER);

const handleSubmit = async () => {
const [phone, name] = [props.phone, props.name];
const handleSubmit = useCallback(async () => {
const { phone, name } = props;
const info = { id, password, name, phone };
try {
const {
Expand All @@ -38,7 +38,7 @@ const InputIdPw: React.FC<InputIdPwProps> = (props) => {
} catch (e) {
showAlert(`오류가 발생했습니다, ${e}`);
}
};
}, [props, id, password]);

return (
<>
Expand Down

0 comments on commit b18cbb3

Please sign in to comment.