잘 스타일링된 것을 확인했다면, props로 error 값을 받아 왔을 때 이를 렌더링해 주도록 하겠습니다.
components/auth/AuthForm.js
(...) const AuthForm = ({ type, form, onChange, onSubmit, error }) => { 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} /> )} {error && <ErrorMessage>{error}</ErrorMessage>} <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;