reject는 Error 객체로 한다 — 문자열로 거부하면 스택 트레이스가 남지 않는다.1
// ❌
Promise.reject('An error occurred');
// ✅
Promise.reject(new Error('An error occurred'));
Footnotes
const formData = new FormData();
const single = document.querySelector('input[type="file"]');
const multiple = document.querySelector('input[type="file"][multiple]');
formData.append('single', single.files[0]);
[...multiple].forEach((file, index) => {
formData.append(`multiple_${index}`, file);
})
fetch('https://example.com/posts', {
method: 'POST',
body: formData,
})
Footnotes
{
"tailwindcss": "tailwindcss -i ./src/index.css -o ./src/tailwind.css",
"start": "concurrently \"yarn tailwindcss --watch\"",
"prebuild": "yarn tailwindcss --minify",
}
create-react-app 구형버젼(+eject)에서 설치할 경우 연관된 부분이 많아서 차라리 cli를 사용하는게 편한 상황. 그런데 concurrently1로 프로세스를 동시에 실행시켜야 되는 부분이 있다.
Footnotes
Advanced Features: Static HTML Export | Next.js
next export
앱의 HTML 버전을 빌드. .out 디렉토리에 빌드된 페이지 파일을 복사합니다.
How To Maintain A Large Next.js Application — Smashing Magazine
- TypeScript 사용
- Lerna , Nx , Rush , Turborepo , yarn workspaces를 사용하여 Mono-Repo 구조 사용
- Hygen과 같은 코드 생성기를 사용하여 상용구 코드 생성
- Redux 툴킷을 통해 하위 상용구와 함께 Redux와 같이 잘 설정된 패턴 사용
- 비동기 데이터를 가져오기 위해 React 쿼리 또는 SWR 사용
- Husky와 함께 Commitizen 및 Semantic Release 사용
- UI 구성 요소 시각화를 위해 스토리북 사용
- 처음부터 유지 관리 가능한 테스트 작성
- Dependabot을 사용하여 자동으로 패키지 업데이트
- Production Checklist | Next.js
No, disabling a button is not app logic. - DEV Community
- "idle" 아무 것도 아직 일어나지 않았다.
- "loading" 진행중
- "success" 성공적
- "failure" 오류가 발생했음