๋ฐ˜์‘ํ˜•

Framework 86

[React] div scroll ๋งจ ์œ„๋กœ ์˜ฌ๋ฆฌ๊ธฐ / scroll ์ปจํŠธ๋กค ํ•˜๋Š” ๋ฐฉ๋ฒ• (useRef ์‚ฌ์šฉ)

Intro ์•ˆ๋…•ํ•˜์„ธ์š”. ์ด๋ฒˆ ์‹œ๊ฐ„์—๋Š” React scroll ์Šคํฌ๋กค์„ ์ปจํŠธ๋กคํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. My case ์ €์˜ ๊ฒฝ์šฐ ์ปดํฌ๋„ŒํŠธ ํ™”๋ฉด์ด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ตฌ์„ฑ๋˜์–ด ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. ๊ฒŒ์‹œ๊ธ€ ๋ฆฌ์ŠคํŠธ๊ฐ€ ์žˆ๊ณ , ํŠน์ • ๊ฒŒ์‹œ๊ธ€์„ ํด๋ฆญํ•˜๋Š” ์ˆœ๊ฐ„ ํŠน์ • ๊ฒŒ์‹œ๊ธ€์— ๋Œ€ํ•œ ๋‚ด์šฉ์ด ๋ณด์ด๊ณ , ์•„๋ž˜๋กœ ๋‹ค๋ฅธ ๊ฒŒ์‹œ๊ธ€๋กœ ์ด๋™ํ•  ์ˆ˜ ์žˆ๋Š” ์ตœ์‹  ๊ฒŒ์‹œ๊ธ€ ๋ชฉ๋ก์ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ตœ์‹  ๊ฒŒ์‹œ๊ธ€ ๋ชฉ๋ก ์ค‘ ํ•˜๋‚˜๋ฅผ ํด๋ฆญํ•˜๋ฉด, ๋ณธ๋ฌธ ๋‚ด์šฉ์ด ๋ณ€ํ•˜๋Š” ํ˜•์‹์ž…๋‹ˆ๋‹ค. How to solve the problem 1. ๋Œ€์ƒ div์— ref๋ฅผ ํ™œ์šฉํ•˜๊ธฐ ์œ„ํ•ด ์•„๋ž˜์˜ ์ฝ”๋“œ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. const postDetailRef = useRef(null); 2. ์ •์˜ํ•œ ref ๊ฐ’์„ div tag์— ํ• ๋‹นํ•ด์ค๋‹ˆ๋‹ค. {postDetail && ( {postDetail.title} {..

Framework/React 2023.03.06

[React] DatePicker RangeError: Invalid time value safari ์˜ค๋ฅ˜

Intro ์•ˆ๋…•ํ•˜์„ธ์š”. ๋ฆฌ์•กํŠธ์—์„œ DatePicker๋กœ Date ๊ฐ์ฒด๋ฅผ ๋‹ค๋ฃจ๋˜ ๋„์ค‘ ํ•ด๋‹น ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. RangeError: Invalid time value ๋กœ์ปฌ PC ํฌ๋กฌ ํ™˜๊ฒฝ์—์„œ ํ…Œ์ŠคํŠธ ํ–ˆ์„ ๋•Œ๋Š” ๋‚˜์ง€ ์•Š์•˜๋˜ ์˜ค๋ฅ˜์˜€๊ณ , IOS ์›น์•ฑ ํ…Œ์ŠคํŠธ๋ฅผ ํ•˜๋˜ ๋„์ค‘ ๋ฐœ๊ฒฌํ•˜๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋ฐ”๋กœ ๊ตฌ๊ธ€๋ง์„ ํ•ด๋ดค์Šต๋‹ˆ๋‹ค. ์ฐธ๊ณ ๋กœ ์ €๋Š” ex) 2023.03.01 ํ˜•ํƒœ์˜ ์ŠคํŠธ๋ง ๋ฌธ์ž๋ฅผ new Date๋กœ ๋ณ€ํ™˜ํ–ˆ์Šต๋‹ˆ๋‹ค. Why? ํฌ๋กฌ์€ dot(.)ํ˜•์‹์„ ํฌํ•จํ•˜๋Š” ๋ฌธ์ž์—ด์„ new Date๋กœ ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ์ง€๋งŒ, ์‚ฌํŒŒ๋ฆฌ์˜ ๊ฒฝ์šฐ date ๋ณ€ํ™˜ ์‹œ format์— dot(.)๋ฅผ ํฌํ•จํ•  ๊ฒฝ์šฐ ์—๋Ÿฌ๋ฅผ ๋ฐœ์ƒ์‹œํ‚จ๋‹ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค. How to solve the problem ํ•ด๋‹น ์—๋Ÿฌ๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์€ ์—ฌ๋Ÿฌ ๊ฐ€์ง€๊ฐ€ ์žˆ๋Š”๋ฐ์š”. ์ €๋Š” ์•„๋ž˜์˜ ..

Framework/React 2023.03.01

[SpringBoot] kotlin + SpringBoot + mongodb MongoRepository์—์„œ limit ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•

Intro ์•ˆ๋…•ํ•˜์„ธ์š”. ์ด๋ฒˆ์‹œ๊ฐ„์—๋Š” ์Šคํ”„๋ง๋ถ€ํŠธ + mongodb MongoRepository์—์„œ limit ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. How to solve the problem ์•„๋ž˜ ์ฝ”๋“œ์™€ ๊ฐ™์ด limit() ๋ฉ”์„œ๋“œ๋ฅผ ํ™œ์šฉํ•˜์—ฌ ์›ํ•˜๋Š” count ๋งŒํผ ์กฐํšŒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. suspend fun getRecentData(createAt: Instant): List? { val query = Query() query.with( Sort.by(Sort.Direction.DESC, "createAt") ) query.limit(3) return metaHotMongoTemplate.find(query, SomeDTO::class.java, collectionName).collectList() .awa..

[React] Module not found: Can't resolve ์˜ค๋ฅ˜ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

Intro ์•ˆ๋…•ํ•˜์„ธ์š”. ์ด๋ฒˆ ์‹œ๊ฐ„์—๋Š” ๋ฆฌ์•กํŠธ์—์„œ ์ข…์ข… ๋‚˜ํƒ€๋‚˜๋Š” ์˜ค๋ฅ˜์ธ Module not found: Can't resolve ์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค. Module not found: Can't resolve "๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ช…" ์šด์˜ ์ด์Šˆ๊ฐ€ ์ ‘์ˆ˜๋˜์–ด ํ•ด๋‹น ์ด์Šˆ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด project ๋ฅผ ์—ด์—ˆ๋Š”๋ฐ์š”, ๊ฐ‘์ž๊ธฐ run ํƒ€์ž„์— ์œ„์™€ ๊ฐ™์€ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋กœ ์ถ”๊ฐ€ ์„ค์น˜ํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋„ ์—†์—ˆ๋Š”๋ฐ ์™œ ์˜ค๋ฅ˜๊ฐ€ ๋‚˜๋Š”์ง€ ๋ชจ๋ฅด๊ฒ ๋”๋ผ๊ณ ์š”. ํ„ฐ๋ฏธ๋„์— ๋‚˜ํƒ€๋‚œ ํ•ด๋‹น ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์„ค์น˜ํ•ด๋„ ๋˜‘๊ฐ™์€ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ๋ฒ„์ „์„ ๋ฐ”๊พธ๊ณ , ํ•ด๋‹น ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ๋‹ค์‹œ ์„ค์น˜ํ•ด๋„ ๊ณ„์† ๊ฐ™์€ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ๊ตฌ์š”. ๊ทธ๋ž˜์„œ ์ตœํ›„์˜ ์ˆ˜๋‹จ์œผ๋กœ ๋‹ค์Œ์˜ ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค! How to solve 1. ์•„๋ž˜ ํŒŒ์ผ ๋ฐ ํด๋”๋ฅผ ์‚ญ์ œํ•ฉ๋‹ˆ๋‹ค. - yarn-..

Framework/React 2023.02.23

[React] xlsx library ์‚ฌ์šฉ ์‹œ ๋ชจ๋ฐ”์ผ ๊ธฐ๊ธฐ (ios/android) ์—‘์…€ ํŒŒ์ผ ์•ˆ์—ด๋ฆฌ๋Š” ์˜ค๋ฅ˜ ํ•ด๊ฒฐ๋ฒ• (+ ์—‘์…€ ํ™•์žฅ์ž)

Intro ์•ˆ๋…•ํ•˜์„ธ์š”. react ์—์„œ xlsx ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์—‘์…€ ๋‹ค์šด๋กœ๋“œ ๊ฐ€๋Šฅ์„ ๊ตฌํ˜„ํ–ˆ๋Š”๋ฐ์š”, ์›น์•ฑ์ด์—ฌ์„œ PC ๋ธŒ๋ผ์šฐ์ €์—์„œ๋งŒ ํ…Œ์ŠคํŠธ ํ•ด๋ณด๊ณ , ์‹ค์ œ ios / android ์—์„œ๋Š” ํ…Œ์Šค๋ฅผ ํ•ด๋ณด์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‹น์—ฐํžˆ PC ๋ธŒ๋ผ์šฐ์ €์—์„œ ์—‘์…€ ํŒŒ์ผ์ด ์ž˜ ๋‹ค์šด๋ฐ›์•„์ง€๊ณ , ์ž˜ ์—ด๋Ÿฌ์„œ ๋™์ž‘์ด ์ž˜ ๋ ๊ฑฐ๋ผ๊ณ  ์ƒ๊ฐํ–ˆ์–ด์š”. ํ•˜์ง€๋งŒ, ์‹ค์ œ ๋ชจ๋ฐ”์ผ ๊ธฐ๊ธฐ์—์„œ ํ…Œ์ŠคํŠธ ํ•ด๋ณด๋‹ˆ ์—‘์…€ ํŒŒ์ผ ๋‹ค์šด์€ ๋˜๋Š”๋ฐ, ์—ด๋ฆฌ์ง€๊ฐ€ ์•Š๋”๋ผ๊ณ ์š”. ์›์ธ์ด ๋ฌด์—‡์ผ๊นŒ ๊ณ ๋ฏผํ•˜๋ฉฐ ๊ตฌ๊ธ€๋ง์„ ํ•ด๋ดค์Šต๋‹ˆ๋‹ค. How to solve the problem ๊ธฐ์กด์— ์ €๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ํ™•์žฅ์ž๋ฅผ xlsx์„ ์‚ฌ์šฉ์˜€๋Š”๋ฐ์š”, XLSX.writeFile (wb,"sample.xlsx "); ์ด๋ ‡๊ฒŒ ํ™•์žฅ์ž๋ฅผ xls๋กœ ๋ฐ”๊พธ๊ณ , ๋ชจ๋ฐ”์ผ์—์„œ ํ…Œ์ŠคํŠธ ํ•ด๋ณด๋‹ˆ ์ž˜ ์—ด๋ฆฌ๋”๋ผ๊ณ ์š”. XLSX.wr..

Framework/React 2023.02.22

[React] apexcharts yaxis (y์ถ•) 0๋ถ€ํ„ฐ ์‹œ์ž‘ํ•˜๋Š” ๋ฐฉ๋ฒ•

Intro ์•ˆ๋…•ํ•˜์„ธ์š”. ์ด๋ฒˆ ์‹œ๊ฐ„์—๋Š” apexcharts ์—์„œ yaxis y์ถ•์„ 0๋ถ€ํ„ฐ ์‹œ์ž‘ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. apexcharts๋ฅผ ์ด์šฉํ•ด์„œ ์ฐจํŠธ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ž‘์—…ํ•˜๊ณ  ์žˆ์—ˆ๋Š”๋ฐ์š”, ์ฐจํŠธ์˜ y์ถ•๊ฐ’์„ 0์œผ๋กœ ๊ณ ์ •ํ•˜๊ณ  ์‹ถ์€๋ฐ, ๊ณ„์† ์ˆซ์ž ๋ฒ”์œ„๊ฐ€ ๋‹ฌ๋ผ์ง€๋ฉด์„œ ๊ฐ’์ด ๋ณ€ํ•˜๋”๋ผ๊ณ ์š”. ๊ทธ๋ž˜์„œ ๊ตฌ๊ธ€๋ง์„ ํ•ด๋ดค์Šต๋‹ˆ๋‹ค. How to solve the problem ์•„๋ž˜์™€ ๊ฐ™์ด yaxis ์†์„ฑ์—์„œ min์„ 0์„ ์ ์šฉํ•˜๋ฉด y์ถ• ๊ฐ’์ด 0์œผ๋กœ ๊ณ ์ •๋˜์–ด ์„ธํŒ…๋ฉ๋‹ˆ๋‹ค. yaxis: { tickAmount: 3.5, min: 0, forceNiceScale: true, labels: { show: true, rotate: 0, style: { colors: '#828282', fontSize: '11rem', fontFamily..

Framework/React 2023.02.17

[React] apexcharts yaxis (y์ถ•) labels float ์†Œ์ˆ˜์  ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐฉ๋ฒ•, toFixed() ๋ฉ”์„œ๋“œ ์‚ฌ์šฉ

Intro ์•ˆ๋…•ํ•˜์„ธ์š”. ์ด๋ฒˆ ์‹œ๊ฐ„์—๋Š” apexcharts ์—์„œ yaxis label ์˜ ์†Œ์ˆ˜์  ์ฒ˜๋ฆฌ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. How to solve the problem ์•„๋ž˜์™€ ๊ฐ™์ด yaxis > labels > formatter ๋ฅผ ์ ์šฉํ•˜๊ณ , toFixed() ๋ฉ”์†Œ๋“œ๋ฅผ ์ด์šฉํ•˜์—ฌ ๊ฐ’์„ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. yaxis: { labels: { formatter(value) { return value.toFixed(0); }, }, },

Framework/React 2023.02.16

[SpringBoot] ์Šคํ”„๋ง JPA limit pagesize ์ตœ๋Œ€๊ฐ’(maxSize) ์ง€์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•

Intro ์•ˆ๋…•ํ•˜์„ธ์š”. ์ด๋ฒˆ์‹œ๊ฐ„์—๋Š” ์Šคํ”„๋ง JPA์—์„œ pageSize ํŽ˜์ด์ง€ ์‚ฌ์ด์ฆˆ๋ฅผ ์ตœ๋Œ€๊ฐ’์œผ๋กœ ์ง€์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. How to set to maxSize @PageableDefault ์–ด๋…ธํ…Œ์ด์…˜์„ ํ™œ์šฉํ•˜์—ฌ, size๋ฅผ Integer.MAX_VALUE๋กœ ์„ค์ •ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. size๋ฅผ ํ™•์ธํ•ด๋ณด๋ฉด, 2000์œผ๋กœ ์„ค์ •๋œ ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. public SomeResponseObject getSomething( @PageableDefault(size = Integer.MAX_VALUE) Pageable page ) { return someService.getSomething(page); } https://stackoverflow.com/questions/23751193/spring-data-..

[Springboot] ํŽ˜์ด์ง€๋„ค์ด์…˜ Pageable ๊ฐ์ฒด์— ๋Œ€ํ•ด ์•Œ์•„๋ณด์ž

Intro ์•ˆ๋…•ํ•˜์„ธ์š”. ์ด๋ฒˆ ์‹œ๊ฐ„์—๋Š” ์Šคํ”„๋ง๋ถ€ํŠธ์˜ Pageable ํŽ˜์ด์ง€๋„ค์ด์…˜ ๊ฐ์ฒด์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ์ œ ๊ฒฝ์šฐ Task๋ฅผ ์ง„ํ–‰ํ•˜๋˜ ๋„์ค‘ ํŽ˜์ด์ง€๋„ค์ด์…˜์„ ์ถ”๊ฐ€ํ•ด์•ผ ํ•˜๋Š” ์š”๊ตฌ์‚ฌํ•ญ์ด ๋“ค์–ด์˜ธ์Šต๋‹ˆ๋‹ค. ํŽ˜์ด์ง€๋„ค์ด์…˜์„ ๊ตฌํ˜„ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ์—ฌ๋Ÿฌ๊ฐ€์ง€๊ฐ€ ์žˆ๋Š”๋ฐ์š”, ๊ทธ์ค‘์—์„œ๋„ ์ €๋Š” Spring Data JPA๋ฅผ ์ด์šฉํ–ˆ์Šต๋‹ˆ๋‹ค. Spring Data JPA๋ฅผ ์ด์šฉํ•˜๋ฉด Pageable ๊ฐ์ฒด๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํŽ˜์ด์ง€๋„ค์ด์…˜(pagination) ์ •๋ณด๋ฅผ ์‰ฝ๊ฒŒ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. JPA Query ๋ฉ”์„œ๋“œ์˜ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ Pageable์„ ๋„˜๊ฒจ์„œ DB์— ์ฟผ๋ฆฌ๋ฅผ ๋‚ ๋ฆด ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ฆ‰, ์•Œ์•„์„œ ์ž˜ ํ•ด์ฃผ๊ธฐ ๋•Œ๋ฌธ์— ๋งค์šฐ ํŽธํ•˜๊ฒŒ ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค :-) Pageable Pageable๋Š” Pagination ์š”์ฒญ ์ •๋ณด๋“ค์„ ๋‹ด๊ธฐ ์œ„ํ•œ ์ถ”์ƒ ์ธ..

[Springboot] ์Šคํ”„๋ง๋ถ€ํŠธ + ๋ชฝ๊ณ (mongo)์—์„œ OR ์ฟผ๋ฆฌ query ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ• (+ Criteria)

Intro ์•ˆ๋…•ํ•˜์„ธ์š”. ์ด๋ฒˆ ์‹œ๊ฐ„์—๋Š” ์Šคํ”„๋ง๋ถ€ํŠธ + ๋ชฝ๊ณ (mongo)์—์„œ OR ์ฟผ๋ฆฌ query ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. How to do Criteria API๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์•„๋ž˜์™€ ๊ฐ™์ด ์‚ฌ์šฉํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. Criteria criteria = new Criteria(); criteria.orOperator(Criteria.where("A").is(10),Criteria.where("B").is(20)); Query query = new Query(criteria); mongoOps.find(query, .class, "collectionName"); +) ์ฐธ๊ณ ๋กœ Criteria ์€ ๊ธฐ์ค€๊ฐ’์ด๋ผ๋Š” ์˜๋ฏธํž™๋‹ˆ๋‹ค. find ๋ฉ”์†Œ๋“œ ์•ˆ์—์„œ { age: { $gt: 18 } } ์™€ ๊ฐ™์€ ์กฐ๊ฑด๋ฌธ์„ ์ž…๋ ฅํ•˜๋Š” ๋ถ€๋ถ„..

๋ฐ˜์‘ํ˜•