티스토리 뷰
무한스크롤 코드 자체는 생각보다 간단한데 댓글을 리덕스로 전역으로 관리해서 계속 에러가 났다.
스토어에서 관리하지 않고 컴포넌트 자체에서 api 를 요청해서 사용하는 방법을 시도 중...
- 오늘 만든 날짜 형식 변환 모듈 파일
date.js
/* eslint-disable consistent-return */
function formatTime(date) {
if (!date) {
return;
}
let intl = new Intl.DateTimeFormat('ko', { dateStyle: 'short' }).format(
new Date(date),
);
intl = intl.replaceAll(' ', '').slice(0, -1);
if (intl.indexOf(3) !== 0) {
intl = `${intl.slice(0, 3)}0${intl.slice(3, 8)}`;
}
return intl; // 23.01.01
}
function settingDate(date) {
if (!date) {
return;
}
let intl = new Intl.DateTimeFormat('ko', { dateStyle: 'medium' }).format(
new Date(date),
);
intl = intl.replaceAll(' ', '').slice(0, -1);
return intl; // 2023.01.01
}
export { formatTime, settingDate };
https://www.daleseo.com/js-intl-api/
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat
https://fromnowwon.tistory.com/entry/react-ga-google-analytics
https://prod.velog.io/@zero-black/Google-analytics-4-with-React
- 렌더링 최적화 세션 다시 듣기
- 'Access-Control-Allow-Origin': '*' 삭제하기
'Edu_hanghae99 > TIL' 카테고리의 다른 글
[TIL] 230202 (0) | 2023.02.03 |
---|---|
[TIL] 230201 (0) | 2023.02.02 |
[TIL] 230126 (3) | 2023.01.27 |
[TIL] 230125 (0) | 2023.01.25 |
[TIL] 230124 (0) | 2023.01.24 |