다음으로는 컨테이너에서 props로 넣어 주었던 onChange, onSubmit, form 값을 사용하겠습니다.
components/auth/AuthForm.js - AuthForm
const AuthForm = ({ type, form, onChange, onSubmit }) => { const text = textMap[type]; return ( <AuthFormBlock> <h3>{text}</h3> <form onSubmit={onSubmit}> <StyledInput autoComplete="username" name="username" placeholder="아이디" onChange={onChange} value={form.username} /> <StyledInput autoComplete="new-password" name="password" placeholder="비밀번호" type="password" onChange={onChange} value={form.password} /> {type = = = 'register' && ( <StyledInput autoComplete="new-password" name="passwordConfirm" placeholder="비밀번호 확인" type="password" onChange={onChange} value={form.passwordConfirm} /> )} <ButtonWithMarginTop cyan fullWidth style={{ marginTop: '1rem' }}> {text} </ButtonWithMarginTop> </form> <Footer> {type = = = 'login' ? ( <Link to="/register">회원가입</Link> ) : ( <Link to="/login">로그인</Link> )} </Footer> </AuthFormBlock> ); }; export default AuthForm;