import React, { useState } from 'react'; import { Formik } from 'formik'; import * as Yup from 'yup'; import axios from 'axios'; import 'bootstrap/dist/css/bootstrap.css'; import { Link, Redirect } from 'react-router-dom'; function Signup() { // const [state, setState] = useState(false); // if (state) { // return ; // } return (
{ // axios({ // method: 'post', // url: '/users', // data: values, // }).then(res => { // if (res.status === 404) return alert(res.data.error) alert("회원가입이 완료되었습니다!") // setState(true); // }) // .catch(err => { // alert(err.error) // }); setTimeout(() => { setSubmitting(false); }, 400); // finish the cycle in handler }} > {({ errors, touched, handleSubmit, getFieldProps, // contain values, handleChange, handleBlur isSubmitting, }) => (
{touched.name && errors.name ? (
{errors.name}
) : null}
{touched.email && errors.email ? (
{errors.email}
) : null}
{touched.address && errors.address ? (
{errors.address}
) : null}
{touched.password && errors.password ? (
{errors.password}
) : null}
{touched.password2 && errors.password2 ? (
{errors.password2}
) : null}
)}
); } export default Signup;