-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreview.html
More file actions
743 lines (644 loc) · 35.3 KB
/
preview.html
File metadata and controls
743 lines (644 loc) · 35.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DevFlow Blog - Preview</title>
<!-- FOUC Prevention -->
<script>
(function() {
try {
var saved = sessionStorage.getItem('theme');
if (saved === 'dark') document.documentElement.classList.add('dark');
} catch (e) {}
})();
</script>
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
<!-- Highlight.js (light theme default) -->
<link id="hljs-theme" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<!-- Pretendard -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.min.css">
<!-- Main Stylesheet -->
<link rel="stylesheet" href="./style.css">
</head>
<body>
<!-- =====================================================================
HEADER
===================================================================== -->
<header class="header">
<div class="header-inner">
<div class="header-logo">
<a href="#">DevFlow Blog</a>
<div class="blog-subtitle">개발과 일상을 기록합니다</div>
</div>
<nav class="header-nav">
<a href="#" class="active">Home</a>
<a href="#">개발</a>
<a href="#">일상</a>
<a href="#">About</a>
</nav>
<div class="header-actions">
<button class="btn-icon search-toggle" aria-label="검색">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/>
</svg>
</button>
<button class="btn-icon dark-toggle" aria-label="다크 모드 전환">
<!-- Sun icon (shown in dark mode) -->
<svg class="icon-sun" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="5"/>
<line x1="12" y1="1" x2="12" y2="3"/>
<line x1="12" y1="21" x2="12" y2="23"/>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>
<line x1="1" y1="12" x2="3" y2="12"/>
<line x1="21" y1="12" x2="23" y2="12"/>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
</svg>
<!-- Moon icon (shown in light mode) -->
<svg class="icon-moon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
</svg>
</button>
<button class="btn-icon hamburger" aria-label="메뉴">
<svg class="icon-menu" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="3" y1="6" x2="21" y2="6"/>
<line x1="3" y1="12" x2="21" y2="12"/>
<line x1="3" y1="18" x2="21" y2="18"/>
</svg>
<svg class="icon-close" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="18" y1="6" x2="6" y2="18"/>
<line x1="6" y1="6" x2="18" y2="18"/>
</svg>
</button>
</div>
</div>
</header>
<!-- Mobile Menu -->
<nav class="mobile-menu">
<a href="#">Home</a>
<a href="#">개발</a>
<a href="#">일상</a>
<a href="#">About</a>
</nav>
<!-- =====================================================================
MAIN
===================================================================== -->
<main>
<div class="container">
<div class="layout">
<!-- =================================================================
CONTENT AREA
================================================================= -->
<div class="content-area">
<!-- ---------------------------------------------------------------
VIEW 1: POST LIST
--------------------------------------------------------------- -->
<div class="post-list">
<!-- Notice card -->
<article class="post-card notice">
<div class="post-info">
<span class="notice-badge">공지</span>
<div class="post-title" style="margin-top:0.5rem;">
<a href="#">블로그 리뉴얼 및 새로운 스킨 적용 안내</a>
</div>
<div class="post-date">2024.03.20</div>
<p class="post-summary">DevFlow 블로그가 새로운 스킨으로 리뉴얼되었습니다. 다크 모드, 코드 하이라이팅, 목차(TOC) 기능 등 개발자를 위한 다양한 기능이 추가되었습니다. 불편한 점이 있으시면 댓글로 알려주세요.</p>
</div>
</article>
<!-- Post 1 - with thumbnail -->
<article class="post-card">
<div class="post-thumbnail">
<img src="https://picsum.photos/400/300?random=1" alt="React 18 동시성 썸네일" loading="lazy">
</div>
<div class="post-info">
<a href="#" class="post-category">JavaScript</a>
<div class="post-title"><a href="#single-post">React 18의 새로운 동시성 기능 이해하기</a></div>
<div class="post-date">2024.03.15</div>
<p class="post-summary">React 18에서 도입된 Concurrent Mode와 Suspense, useTransition, useDeferredValue 등의 새로운 훅들을 실제 예제와 함께 깊이 있게 살펴봅니다. 렌더링 성능을 획기적으로 개선하는 방법을 알아보세요.</p>
</div>
</article>
<!-- Post 2 - with thumbnail -->
<article class="post-card">
<div class="post-thumbnail">
<img src="https://picsum.photos/400/300?random=2" alt="Docker Compose 썸네일" loading="lazy">
</div>
<div class="post-info">
<a href="#" class="post-category">DevOps</a>
<div class="post-title"><a href="#">Docker Compose로 개발 환경 구축하기</a></div>
<div class="post-date">2024.03.10</div>
<p class="post-summary">Docker Compose를 활용하여 Node.js, PostgreSQL, Redis를 포함한 풀스택 개발 환경을 한 번에 구축하는 방법을 단계별로 설명합니다. 팀원들과 동일한 환경을 쉽게 공유해보세요.</p>
</div>
</article>
<!-- Post 3 - with thumbnail -->
<article class="post-card">
<div class="post-thumbnail">
<img src="https://picsum.photos/400/300?random=3" alt="TypeScript 5.0 썸네일" loading="lazy">
</div>
<div class="post-info">
<a href="#" class="post-category">JavaScript</a>
<div class="post-title"><a href="#">TypeScript 5.0 새로운 데코레이터 패턴</a></div>
<div class="post-date">2024.03.05</div>
<p class="post-summary">TypeScript 5.0에서 공식적으로 안정화된 새로운 데코레이터 사양(TC39 Stage 3)을 기존 실험적 데코레이터와 비교하며 분석합니다. 클래스 기반 코드를 더 선언적으로 작성하는 방법을 탐구해봅니다.</p>
</div>
</article>
<!-- Post 4 - without thumbnail -->
<article class="post-card">
<div class="post-info">
<a href="#" class="post-category">일상</a>
<div class="post-title"><a href="#">개발자로 3년 - 배운 것들과 앞으로의 방향</a></div>
<div class="post-date">2024.02.28</div>
<p class="post-summary">프론트엔드 개발자로 일한 지 3년이 되었습니다. 처음 React를 배우던 때부터 지금까지 어떤 것들을 배웠는지, 어떤 실수를 했는지, 그리고 앞으로 어떤 방향으로 성장하고 싶은지 솔직하게 적어봤습니다.</p>
</div>
</article>
<!-- Post 5 - without thumbnail -->
<article class="post-card">
<div class="post-info">
<a href="#" class="post-category">DevOps</a>
<div class="post-title"><a href="#">GitHub Actions로 CI/CD 파이프라인 자동화하기</a></div>
<div class="post-date">2024.02.20</div>
<p class="post-summary">GitHub Actions를 이용해 코드 푸시부터 테스트, 빌드, 배포까지 자동화하는 전체 파이프라인을 구성하는 방법을 정리합니다. AWS ECR과 ECS를 활용한 컨테이너 배포 자동화도 포함됩니다.</p>
</div>
</article>
<!-- Post 6 - without thumbnail -->
<article class="post-card">
<div class="post-info">
<a href="#" class="post-category">일상</a>
<div class="post-title"><a href="#">개발자를 위한 홈 오피스 세팅 가이드</a></div>
<div class="post-date">2024.02.14</div>
<p class="post-summary">재택근무를 시작한 지 2년이 넘었습니다. 그동안 여러 장비를 써보면서 찾아낸 최적의 홈 오피스 구성을 공유합니다. 모니터, 키보드, 마우스, 조명 등 각 항목별 추천 제품도 함께 소개합니다.</p>
</div>
</article>
</div>
<!-- /post-list -->
<!-- Pagination -->
<nav class="pagination">
<a href="#" class="prev" aria-label="이전 페이지">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="15 18 9 12 15 6"/>
</svg>
</a>
<a href="#" class="num">1</a>
<a class="num">2</a>
<a href="#" class="num">3</a>
<a href="#" class="num">4</a>
<a href="#" class="num">5</a>
<a href="#" class="next" aria-label="다음 페이지">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="9 18 15 12 9 6"/>
</svg>
</a>
</nav>
<!-- ---------------------------------------------------------------
DIVIDER between list and single post
--------------------------------------------------------------- -->
<hr id="single-post" style="margin: 4rem 0; border: none; border-top: 2px dashed var(--border-color);">
<p style="text-align:center; font-size:0.8125rem; color:var(--text-tertiary); margin-bottom:3rem; margin-top:-2rem;">— 아래는 단일 포스트 뷰 미리보기입니다 —</p>
<!-- ---------------------------------------------------------------
VIEW 2: SINGLE POST
--------------------------------------------------------------- -->
<!-- Post Header -->
<div class="post-header">
<a href="#" class="post-category">JavaScript</a>
<h1 class="post-title">React 18의 새로운 동시성 기능 이해하기</h1>
<div class="post-meta">
<span>2024.03.15</span>
<span>읽는 데 약 8분</span>
<span>조회 1,234</span>
</div>
<div class="post-admin">
<a href="#">수정</a>
<a href="#">삭제</a>
</div>
</div>
<!-- Table of Contents (in-content, visible on ≤1024px via media query) -->
<div class="toc" style="position:relative; top:0; max-height:none; margin-bottom:2rem; padding:1rem; background-color:var(--bg-secondary); border:1px solid var(--border-color); border-radius:var(--radius-md);">
<div class="toc-title">목차</div>
<ul class="toc-list">
<li><a href="#section-1" class="toc-link active">1. Concurrent Mode란?</a></li>
<li class="toc-h3"><a href="#section-1-1" class="toc-link">1.1 기존 렌더링의 문제점</a></li>
<li class="toc-h3"><a href="#section-1-2" class="toc-link">1.2 동시성 렌더링의 동작 방식</a></li>
<li><a href="#section-2" class="toc-link">2. 주요 신규 API</a></li>
<li class="toc-h3"><a href="#section-2-1" class="toc-link">2.1 useTransition</a></li>
<li class="toc-h3"><a href="#section-2-2" class="toc-link">2.2 useDeferredValue</a></li>
<li><a href="#section-3" class="toc-link">3. 실전 활용 예제</a></li>
<li><a href="#section-4" class="toc-link">4. 마치며</a></li>
</ul>
</div>
<!-- Post Body -->
<article class="post-content">
<p>React 18은 2022년 3월에 정식 릴리즈된 이후 프론트엔드 생태계에 큰 변화를 가져왔습니다. 그 중심에는 <strong>동시성(Concurrency)</strong> 개념이 있습니다. 이 글에서는 Concurrent Mode의 핵심 아이디어부터 실제 코드에서 어떻게 활용하는지까지 단계별로 살펴보겠습니다.</p>
<h2 id="section-1">1. Concurrent Mode란?</h2>
<p>기존의 React 렌더링은 동기적(synchronous)이었습니다. 한 번 렌더링이 시작되면 완료될 때까지 메인 스레드를 점유하므로, 복잡한 UI 업데이트 중에는 사용자 입력이 차단되는 문제가 있었습니다.</p>
<h3 id="section-1-1">1.1 기존 렌더링의 문제점</h3>
<p>무거운 컴포넌트 트리를 렌더링할 때 발생하는 "Jank" 현상을 경험해본 적이 있으실 것입니다. 사용자가 검색창에 타이핑하는 동안 결과 목록이 지연 렌더링되면서 입력 자체가 뚝뚝 끊기는 현상이 대표적인 예입니다.</p>
<blockquote>
<p>"동시성(Concurrency)은 두 가지 작업을 동시에 하는 것이 아니라, 한 작업을 잠깐 멈추고 다른 작업을 처리한 뒤 돌아올 수 있는 능력입니다." — React 공식 문서</p>
</blockquote>
<h3 id="section-1-2">1.2 동시성 렌더링의 동작 방식</h3>
<p>React 18의 Concurrent Renderer는 렌더링 작업을 작은 단위로 나누고, 우선순위가 높은 업데이트(사용자 입력 등)가 들어오면 현재 진행 중인 렌더링을 일시 중단(interrupt)합니다. 이를 통해 UI가 항상 반응성을 유지할 수 있습니다.</p>
<p>핵심은 React가 렌더링 트리를 메모리에 미리 준비(off-screen)하고, 준비가 완료되면 한 번에 커밋(commit)한다는 것입니다. 이 과정에서 <code>startTransition</code>, <code>useTransition</code>, <code>useDeferredValue</code> 같은 새로운 API들이 사용됩니다.</p>
<h2 id="section-2">2. 주요 신규 API</h2>
<h3 id="section-2-1">2.1 useTransition</h3>
<p><code>useTransition</code>은 상태 업데이트를 "전환(transition)"으로 표시하여 긴급하지 않은 렌더링을 지연시킬 수 있게 합니다. <code>isPending</code> 플래그로 로딩 상태도 추적할 수 있습니다.</p>
<!-- Code block -->
<div>
<div class="code-header">
<span class="code-lang">jsx</span>
<button class="btn-copy" onclick="copyCode(this)">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
</svg>
Copy
</button>
</div>
<pre><code class="language-jsx">import { useState, useTransition } from 'react';
function SearchPage() {
const [query, setQuery] = useState('');
const [results, setResults] = useState([]);
const [isPending, startTransition] = useTransition();
function handleChange(e) {
const value = e.target.value;
setQuery(value); // 즉시 업데이트 (긴급)
startTransition(() => {
// 검색 결과 업데이트 (비긴급 - 지연 가능)
const filtered = heavyFilter(value);
setResults(filtered);
});
}
return (
<div>
<input value={query} onChange={handleChange} />
{isPending ? (
<p>검색 중...</p>
) : (
<ResultList items={results} />
)}
</div>
);
}</code></pre>
</div>
<h3 id="section-2-2">2.2 useDeferredValue</h3>
<p><code>useDeferredValue</code>는 props나 state의 지연된 버전을 만들어 렌더링 우선순위를 낮출 때 사용합니다. 컴포넌트 외부에서 전달받은 값을 제어할 수 없을 때 유용합니다.</p>
<p>기존의 debounce와 비슷해 보이지만, React의 스케줄러와 통합되어 있어 CPU가 여유 있을 때 자동으로 처리됩니다. 고정된 지연 시간 없이 기기 성능에 맞게 자동 조절됩니다.</p>
<h2 id="section-3">3. 실전 활용 예제</h2>
<p>아래는 대용량 데이터 목록을 렌더링할 때 <code>useDeferredValue</code>를 활용하는 패턴입니다. 검색 입력의 반응성을 유지하면서 무거운 목록 렌더링을 지연시킵니다.</p>
<img src="https://picsum.photos/720/400?random=10" alt="React 동시성 렌더링 다이어그램">
<p>위 다이어그램은 긴급 업데이트(urgent update)와 전환 업데이트(transition update)가 어떻게 우선순위를 갖고 처리되는지 보여줍니다. 사용자 입력은 항상 높은 우선순위를 갖고 먼저 처리됩니다.</p>
<p>실제 프로젝트에서 사용할 때 고려해야 할 사항들을 정리해봤습니다:</p>
<ul>
<li><code>useTransition</code>은 상태를 직접 제어할 수 있을 때 사용합니다</li>
<li><code>useDeferredValue</code>는 외부에서 props로 받은 값을 지연시킬 때 사용합니다</li>
<li>두 API 모두 Concurrent 기능이므로 React 18 이상에서만 동작합니다</li>
<li>과도한 사용은 오히려 UX를 해칠 수 있으므로 실제 성능 병목이 있을 때만 적용하세요</li>
</ul>
<p>아래 표는 상황별 적합한 API를 정리한 것입니다:</p>
<table>
<thead>
<tr>
<th>상황</th>
<th>추천 API</th>
<th>비고</th>
</tr>
</thead>
<tbody>
<tr>
<td>검색 입력 + 필터링</td>
<td><code>useTransition</code></td>
<td>상태를 직접 컨트롤</td>
</tr>
<tr>
<td>부모에서 내려온 쿼리</td>
<td><code>useDeferredValue</code></td>
<td>props 지연</td>
</tr>
<tr>
<td>페이지 전환 로딩</td>
<td><code>Suspense</code></td>
<td>라우팅과 연동</td>
</tr>
<tr>
<td>데이터 패칭</td>
<td><code>Suspense</code></td>
<td>서버 컴포넌트와 함께</td>
</tr>
</tbody>
</table>
<h2 id="section-4">4. 마치며</h2>
<p>React 18의 동시성 기능은 단순한 성능 최적화 도구를 넘어, UI 개발의 패러다임을 바꾸는 변화입니다. 처음에는 복잡해 보이지만, <code>useTransition</code>과 <code>useDeferredValue</code>를 실제 프로젝트에 적용해보면 그 차이를 명확하게 체감할 수 있습니다.</p>
<p>다음 글에서는 <strong>React Server Components</strong>와 동시성 기능이 어떻게 함께 동작하는지 살펴보겠습니다. 궁금한 점이나 피드백은 댓글로 남겨주세요!</p>
</article>
<!-- Tags -->
<div class="post-tags">
<a href="#">#React</a>
<a href="#">#JavaScript</a>
<a href="#">#프론트엔드</a>
<a href="#">#동시성</a>
</div>
<!-- Prev/Next Navigation -->
<nav class="post-navigation">
<a href="#" class="post-nav-item prev">
<div class="post-nav-label">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="15 18 9 12 15 6"/>
</svg>
이전 글
</div>
<div class="post-nav-title">TypeScript 5.0 새로운 데코레이터 패턴</div>
</a>
<a href="#" class="post-nav-item next">
<div class="post-nav-label">
다음 글
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="9 18 15 12 9 6"/>
</svg>
</div>
<div class="post-nav-title">Docker Compose로 개발 환경 구축하기</div>
</a>
</nav>
<!-- ---------------------------------------------------------------
COMMENTS
--------------------------------------------------------------- -->
<section class="comments-section">
<h2 class="comments-title">댓글 4개</h2>
<ul class="comment-list">
<!-- Comment 1 -->
<li class="comment-item">
<div class="comment-header">
<span class="comment-author">김민준</span>
<span class="comment-date">2024.03.16 09:14</span>
</div>
<div class="comment-body">
<p>정말 잘 설명해주셨네요! useTransition과 useDeferredValue의 차이가 항상 헷갈렸는데 표로 정리해주신 부분이 특히 도움이 됐습니다. 감사합니다.</p>
</div>
<div class="comment-actions">
<button>답글</button>
<button>신고</button>
</div>
<!-- Reply -->
<div class="comment-reply">
<div class="comment-header">
<span class="comment-author">DevFlow</span>
<span class="comment-date">2024.03.16 11:30</span>
</div>
<div class="comment-body">
<p>도움이 되셨다니 다행입니다! 두 API가 겉보기엔 비슷해 보여도 사용 맥락이 확실히 다르죠. 다음 글에서 실제 성능 비교도 다뤄볼 예정이니 기대해 주세요 😊</p>
</div>
</div>
</li>
<!-- Comment 2 -->
<li class="comment-item">
<div class="comment-header">
<span class="comment-author">박서연</span>
<span class="comment-date">2024.03.17 14:52</span>
</div>
<div class="comment-body">
<p>현재 프로젝트에서 검색 기능 구현 중인데 마침 딱 필요한 내용이었습니다. startTransition을 적용해봤더니 확실히 입력 반응이 좋아지네요. 실무에서 바로 쓸 수 있는 예제 공유해주셔서 감사해요!</p>
</div>
<div class="comment-actions">
<button>답글</button>
<button>신고</button>
</div>
<!-- Reply -->
<div class="comment-reply">
<div class="comment-header">
<span class="comment-author">DevFlow</span>
<span class="comment-date">2024.03.17 16:05</span>
</div>
<div class="comment-body">
<p>실제로 효과를 느끼셨다니 저도 기쁘네요! 데이터가 많은 경우에는 더욱 효과가 크게 나타날 거예요. 추가로 궁금한 점이 있으시면 편하게 댓글 남겨주세요.</p>
</div>
</div>
</li>
</ul>
<!-- Comment Form -->
<form class="comment-form">
<div class="form-row">
<input type="text" placeholder="이름" required>
<input type="password" placeholder="비밀번호">
</div>
<textarea placeholder="댓글을 작성해주세요..."></textarea>
<button type="submit" class="btn-submit">댓글 등록</button>
</form>
</section>
</div>
<!-- /content-area -->
<!-- =================================================================
SIDEBAR
================================================================= -->
<aside class="sidebar">
<!-- About widget -->
<div class="sidebar-widget">
<div class="sidebar-profile">
<img src="https://picsum.photos/80/80?random=99" alt="프로필 사진">
<div class="profile-name">DevFlow</div>
<p class="profile-desc">프론트엔드 개발자. JavaScript, React, TypeScript를 주로 씁니다. 좋은 코드와 좋은 UX에 관심이 많습니다.</p>
</div>
</div>
<!-- Category widget -->
<div class="sidebar-widget">
<h3 class="sidebar-widget-title">카테고리</h3>
<ul class="category-list">
<li>
<a href="#">
전체
<span class="category-count">24</span>
</a>
</li>
<li>
<a href="#">
JavaScript
<span class="category-count">12</span>
</a>
</li>
<li class="sub-category">
<a href="#">
React
<span class="category-count">7</span>
</a>
</li>
<li class="sub-category">
<a href="#">
TypeScript
<span class="category-count">5</span>
</a>
</li>
<li>
<a href="#">
DevOps
<span class="category-count">8</span>
</a>
</li>
<li class="sub-category">
<a href="#">
Docker
<span class="category-count">4</span>
</a>
</li>
<li class="sub-category">
<a href="#">
CI/CD
<span class="category-count">4</span>
</a>
</li>
<li>
<a href="#">
일상
<span class="category-count">4</span>
</a>
</li>
</ul>
</div>
<!-- Recent posts widget -->
<div class="sidebar-widget">
<h3 class="sidebar-widget-title">최근 글</h3>
<ul class="recent-posts">
<li>
<a href="#">React 18의 새로운 동시성 기능 이해하기</a>
<span class="recent-post-date">2024.03.15</span>
</li>
<li>
<a href="#">Docker Compose로 개발 환경 구축하기</a>
<span class="recent-post-date">2024.03.10</span>
</li>
<li>
<a href="#">TypeScript 5.0 새로운 데코레이터 패턴</a>
<span class="recent-post-date">2024.03.05</span>
</li>
<li>
<a href="#">개발자로 3년 - 배운 것들과 앞으로의 방향</a>
<span class="recent-post-date">2024.02.28</span>
</li>
<li>
<a href="#">GitHub Actions로 CI/CD 파이프라인 자동화하기</a>
<span class="recent-post-date">2024.02.20</span>
</li>
</ul>
</div>
</aside>
<!-- /sidebar -->
</div>
<!-- /layout -->
</div>
<!-- /container -->
</main>
<!-- =====================================================================
FOOTER
===================================================================== -->
<footer class="footer">
<div class="container">
<div class="footer-inner">
<div class="footer-title">DevFlow Blog</div>
<p class="footer-copyright">Copyright © <span data-year></span> DevFlow. All rights reserved.</p>
<p class="footer-powered">Powered by <a href="https://www.tistory.com" target="_blank" rel="noopener">Tistory</a></p>
</div>
</div>
</footer>
<!-- =====================================================================
SEARCH OVERLAY
===================================================================== -->
<div class="search-overlay" role="dialog" aria-modal="true" aria-label="검색">
<div class="search-container">
<div class="search-input-wrap">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/>
</svg>
<input type="text" placeholder="검색어를 입력하세요..." data-search-input>
<button class="search-close">ESC</button>
</div>
<div class="search-results">
<a href="#" class="search-result-item">
<div class="result-title">React 18의 새로운 동시성 기능 이해하기</div>
<div class="result-snippet">React 18에서 도입된 Concurrent Mode와 Suspense, useTransition...</div>
</a>
<a href="#" class="search-result-item">
<div class="result-title">TypeScript 5.0 새로운 데코레이터 패턴</div>
<div class="result-snippet">TypeScript 5.0에서 공식적으로 안정화된 새로운 데코레이터 사양...</div>
</a>
<a href="#" class="search-result-item">
<div class="result-title">Docker Compose로 개발 환경 구축하기</div>
<div class="result-snippet">Docker Compose를 활용하여 Node.js, PostgreSQL, Redis를 포함한...</div>
</a>
</div>
</div>
</div>
<!-- =====================================================================
BACK TO TOP
===================================================================== -->
<button class="back-to-top" aria-label="맨 위로 이동">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<polyline points="18 15 12 9 6 15"/>
</svg>
</button>
<!-- =====================================================================
INLINE SCRIPTS
===================================================================== -->
<script>
// Highlight.js init
hljs.highlightAll();
// Dark mode toggle
document.querySelector('.dark-toggle').addEventListener('click', function() {
document.documentElement.classList.toggle('dark');
var themeLink = document.getElementById('hljs-theme');
if (document.documentElement.classList.contains('dark')) {
themeLink.href = 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css';
} else {
themeLink.href = 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css';
}
});
// Search overlay
document.querySelector('.search-toggle').addEventListener('click', function() {
document.querySelector('.search-overlay').classList.add('active');
document.querySelector('[data-search-input]').focus();
});
document.querySelector('.search-close').addEventListener('click', function() {
document.querySelector('.search-overlay').classList.remove('active');
});
document.querySelector('.search-overlay').addEventListener('click', function(e) {
if (e.target === this) this.classList.remove('active');
});
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
document.querySelector('.search-overlay').classList.remove('active');
}
});
// Back to top
var backToTop = document.querySelector('.back-to-top');
window.addEventListener('scroll', function() {
if (window.pageYOffset > 300) {
backToTop.classList.add('visible');
} else {
backToTop.classList.remove('visible');
}
});
backToTop.addEventListener('click', function() {
window.scrollTo({ top: 0, behavior: 'smooth' });
});
// Year
document.querySelector('[data-year]').textContent = new Date().getFullYear();
// Mobile menu
document.querySelector('.hamburger').addEventListener('click', function() {
document.querySelector('.mobile-menu').classList.toggle('active');
this.classList.toggle('active');
});
// Copy code button
function copyCode(btn) {
var code = btn.closest('div').nextElementSibling.querySelector('code');
navigator.clipboard.writeText(code.innerText).then(function() {
btn.classList.add('copy-success');
btn.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg> Copied!';
setTimeout(function() {
btn.classList.remove('copy-success');
btn.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg> Copy';
}, 2000);
});
}
</script>
</body>
</html>