node -v
yarn --version
yarn install
yarn dev
localhost:3000 으로 접속해 보세요 !
-
typescript
-
next.js
-
mui/material ui
-
emotion
-
react-hook-form ❤️
pages/
create.tsx
src/
components/
containers/
styles/
utils/
export interface ResumeProps {
title: string;
profile: ProfileProps;
introduction: string;
careers: CareerProps[];
skills: { key: string; label: string }[];
}
export interface ProfileProps {
name: string;
email: string;
phone: string;
}
export interface CareerProps {
date: {
startYear: string;
startMonth: string;
endYear: string;
endMonth: string;
};
isCurrent: boolean;
companyName: string;
department: string;
projects: ProjectProps[];
}
export interface ProjectProps {
title: string;
date: {
startYear: string;
startMonth: string;
endYear: string;
endMonth: string;
};
description: string;
}
import { Controller, useForm } from 'react-hook-form';
const { control } = useForm();
return (
<Controller
//우리가 사용할 form의 control을 넘겨줘요.
control={control}
//form에서 사용할 key
name="name"
//유효성 체크
rules={{ required: true, maxLength: { value: 10, message: '10글자 이하로 입력해주세요.' } }}
//렌더링 부분
render={({ field: { value, onChange }, fieldState: { invalid, error } }) => (
<TextField
variant="standard"
placeholder="이름 (필수)"
value={value}
onChange={onChange}
error={invalid}
helperText={error?.message}
/>
)}
)