็ฎๆฌก (10)
- ํ๋ก์ ํจํด(Proxy Pattern)
- ํ๋ก์ ํจํด ๊ตฌ์กฐ
- ํ๋ก์ ํจํด ์ํ์ค ๋ค์ด์ด๊ทธ๋จ
- ํ๋ก์ ํจํด์ ์ข ๋ฅ
- 1. Virtual Proxy(๊ฐ์ ํ๋ก์, Lazy Loading)
- 2. Protection Proxy(๋ณดํธ ํ๋ก์, ์ ๊ทผ ์ ์ด)
- 3. Remote Proxy(์๊ฒฉ ํ๋ก์, ๋คํธ์ํฌ ์์)
- ํ๋ก์ ํจํด ์์ - ์๋ํฐ์ ์ด๋ฏธ์ง ์ ๋ก๋
- ํ๋ก์ ํจํด์ ์ฅ๋จ์
- ๋ง๋ฌด๋ฆฌ
ํ๋ก์ ํจํด(Proxy Pattern)
ํ๋ก์ ํจํด์ ์ด๋ค ๊ฐ์ฒด์ ๋ํ ์ ๊ทผ์ ์ ์ดํ๊ธฐ ์ํ ์ฉ๋๋ก ๋๋ฆฌ์ธ์ด๋ ๋๋ณ์ธ์ ํด๋นํ๋ ๊ฐ์ฒด๋ฅผ ์ ๊ณตํ๋ ํ๋ ํจํด์ด์์.
์๊ฒฉ, ๊ฐ์, ๋ณดํธ, ์บ์ฑ, ๋ก๊น ํ๋ก์์ ๊ฐ์ด ๋ค์ํ ์ข ๋ฅ๊ฐ ์์ด์. ์ด๋ฐ ํ๋ก์๋ค์ ๋ชฉ์ ์ ํ๋๋ก ์์ฝํ๋ฉด ์์ ์ ๊ทผ ์ ํ ๋ฐ ํต์ ์์. ๋ํ์ ์ธ ์๋ก ์๋ฐ๋ ์๋ฐ์คํฌ๋ฆฝํธ์ Class๋ก ๋ง๋ Instance์ ์์ ์ ๊ทผ์ Proxy๋ฅผ ํตํด์ ๋ถ๊ฐ ์ ์ธ ๊ธฐ๋ฅ์ ์ํํ ์ ์๊ฒ ๋ง๋๋ ๊ฒ์ด์์.
ํ๋ก์ ํจํด ๊ตฌ์กฐ

ํ๋ก์๋ ํน์ ๊ฐ์ฒด์ ๋ํ ์ ๊ทผ ์ ์ด๋ฅผ ํ๊ธฐ ์ํด ์ฌ์ฉ๋๊ณ ํน์ ๊ฐ์ฒด๋ Subject๋ผ๊ณ ํด์. ํ๋ก์(Proxy)๋ Subject ์ธํฐํ์ด์ค๋ฅผ ๋ฐ๋ผ ๊ตฌํํ์ฌ ์ค์ RealSubject์ ์์ ํ ํธํ๋๋๋ก ๋ฐ๊ฟ์ ์์ด์.
์ด๋ ๊ฒ ๊ตฌํํ๋ฉด Client๊ฐ ์ฌ์ฉํ ๋ ๊ธฐ์กด์ Subject ์ธํฐํ์ด์ค๋ฅผ ๊ทธ๋๋ก ์ฌ์ฉํ๋ฉฐ Proxy๊ฐ ์ด๋ป๊ฒ ์๊ฒผ๋์ง ๋ชฐ๋ผ๋ ์ฌ์ฉํ ์ ์์ด์.
Subject : RealSubject๊ฐ ๊ตฌํํ๋ ์ธํฐํ์ด์ค์์. ์๋ง ํ๋ก์๋ฅผ ์ถ๊ฐํ๋ค๋ ๊ฒ์ ์ด๋ฏธ Subject๊ฐ ์์ ํ๋ฅ ์ด ๋์ ๊ฑฐ๋ผ ์๊ฐํด์.
RealSubject : ์ ๊ทผ ์ ์ดํ ์๋ณธ ๊ฐ์ฒด์ด๋ฉฐ, ์ค์ ํต์ฌ ์์ ์ ์ํํ๋ ๊ฐ์ฒด์์.
Proxy : RealSubject์ ๋ํ ์ ๊ทผ์ ์ ์ดํ ์ค๊ฐ์(๋๋ฆฌ์ธ)
ํ๋ก์ ํจํด ์ํ์ค ๋ค์ด์ด๊ทธ๋จ

์ ๊ทธ๋ฆผ์ ์ค์ Client๊ฐ Proxy ํจํด์ผ๋ก ์ฝ๋๋ฅผ ์ฌ์ฉํ๋ฉด ์ด๋ค ์์๋ก ์ฝ๋๊ฐ ์คํ๋ ์ง ๋ณด์ฌ์ค์. Proxy์ request() ๋ฉ์๋๋ฅผ ์ฌ์ฉํ๋ฉด, RealSubject์ ์๊ณ ๋ฆฌ์ฆ์ ๋์ ์์ํ์ฌ ์ฌ์ฉํ๊ณ ๊ทธ ๊ฐ์ ๋ฆฌํดํด์ฃผ๊ฑฐ๋ ์์ฒด์ ์ผ๋ก ๊ธฐ๋ฅ์ ์ถ๊ฐ์ ์ผ๋ก ์คํํ๊ฑฐ๋ ์ ๊ทผ์ ์ ํํ ์ ์์ด์.
ํ๋ก์ ํจํด์ ์ข ๋ฅ
ํ๋ก์์ ์ข ๋ฅ๋ ๋๊ฒ ๋ค์ํด์. ์ฌ๊ธฐ์๋ ๊ฐ์, ๋ณดํธ, ์๊ฒฉ ํ๋ก์๋ง ์ค๋ช ํ๋๋ก ํ ๊ฒ์.
1. Virtual Proxy(๊ฐ์ ํ๋ก์, Lazy Loading)

๊ฐ์ ํ๋ก์๋ ๋ฌด๊ฑฐ์ด ๊ฐ์ฒด๋ฅผ ์ค์ ์์ฒญ ์์ ์ ๋ก๋ฉํ๋ ๊ฒฝ์ฐ ์ฌ์ฉํด์. ๋ณดํต RealSubject ์ธ์คํด์ค ์์ฑ์ด ๋์ง ์์ null์ผ ๊ฒฝ์ฐ initialize() ํจ์๋ฅผ ํตํด ์์ฑ์ด ์๋ฃ๋๋๋ก ํด์. ์ฆ, ๋ฌด๊ฑฐ์ด ๊ฐ์ฒด์ ์์ฑ ์์ ์ ํ์ํ ์์ ์ผ๋ก ์ ์ดํ ์ ์์ด์.
// 2. ๊ฐ์ ํ๋ก์ (Virtual Proxy)// ๋ฌด๊ฑฐ์ด ๊ฐ์ฒด์ ์์ฑ์ ์ค์ ์ฌ์ฉ ์์ ๊น์ง ์ง์ฐclass HeavyImage { constructor(filename) { this.filename = filename; console.log(`[Heavy Object] "${filename}" ๋ก๋ฉ ์์... (๋ฌด๊ฑฐ์ด ์์
)`); // ์ค์ ๋ก๋ ๋์ฉ๋ ์ด๋ฏธ์ง ์ฒ๋ฆฌ ๋ฑ this.data = `${filename}์ ๋์ฉ๋ ๋ฐ์ดํฐ`; console.log(`[Heavy Object] "${filename}" ๋ก๋ฉ ์๋ฃ!`); } display() { console.log(`[Heavy Object] ์ด๋ฏธ์ง ํ์: ${this.filename}`); }}class VirtualImageProxy { constructor(filename) { this.filename = filename; this.realImage = null; console.log(`[Virtual Proxy] "${filename}" ํ๋ก์ ์์ฑ (์ค์ ๊ฐ์ฒด๋ ์์ง ์์ฑ ์๋จ)`); } display() { // ์ค์ ๋ก ์ฌ์ฉํ ๋ ๊ฐ์ฒด ์์ฑ (Lazy Initialization) if (!this.realImage) { console.log(`[Virtual Proxy] ์ด์ ์ค์ ๊ฐ์ฒด๋ฅผ ์์ฑํฉ๋๋ค`); this.realImage = new HeavyImage(this.filename); } this.realImage.display(); }}2. Protection Proxy(๋ณดํธ ํ๋ก์, ์ ๊ทผ ์ ์ด)

proxy๊ฐ RealSubject์ request์์ฒญ์ ํ๊ธฐ ์ ์ checkAccess ๋ฉ์๋๋ฅผ ํตํด ์ ๊ทผ์ ์ ์ดํ ์ ์๋๋ก ํด์. ๋ณดํต ๋ณด์ ๋ชฉ์ ์ ์ํด ์ฌ์ฉํ๋ ๊ฒฝ์ฐ๊ฐ ๋ง์์.
// 3. ๋ณดํธ ํ๋ก์ (Protection Proxy)// ์ ๊ทผ ๊ถํ์ ๋ฐ๋ผ ๊ฐ์ฒด ์ ๊ทผ์ ์ ์ดclass BankAccount { constructor(owner, balance) { this.owner = owner; this.balance = balance; } deposit(amount) { this.balance += amount; console.log(`[๊ณ์ข] ${amount}์ ์
๊ธ. ์์ก: ${this.balance}์`); } withdraw(amount) { if (this.balance >= amount) { this.balance -= amount; console.log(`[๊ณ์ข] ${amount}์ ์ถ๊ธ. ์์ก: ${this.balance}์`); return true; } console.log(`[๊ณ์ข] ์์ก ๋ถ์กฑ`); return false; } getBalance() { return this.balance; }}class BankAccountProxy { constructor(account, currentUser) { this.account = account; this.currentUser = currentUser; } deposit(amount) { console.log(`[ํ๋ก์] ${this.currentUser}๊ฐ ์
๊ธ ์๋`); // ๋๊ตฌ๋ ์
๊ธ ๊ฐ๋ฅ return this.account.deposit(amount); } withdraw(amount) { console.log(`[ํ๋ก์] ${this.currentUser}๊ฐ ์ถ๊ธ ์๋`); // ์์ ์๋ง ์ถ๊ธ ๊ฐ๋ฅ if (this.currentUser === this.account.owner) { return this.account.withdraw(amount); } else { console.log(`[ํ๋ก์] ๊ถํ ์์! ${this.currentUser}๋ ์ถ๊ธํ ์ ์์ต๋๋ค.`); return false; } } getBalance() { console.log(`[ํ๋ก์] ${this.currentUser}๊ฐ ์์ก ์กฐํ ์๋`); // ์์ ์๋ง ์์ก ์กฐํ ๊ฐ๋ฅ if (this.currentUser === this.account.owner) { return this.account.getBalance(); } else { console.log(`[ํ๋ก์] ๊ถํ ์์! ์์ก ์กฐํ ๋ถ๊ฐ`); return null; } }}// Clientconst account = new BankAccount('๊น์ฒ ์', 10000);const ownerProxy = new BankAccountProxy(account, '๊น์ฒ ์');console.log(`์์ก: ${ownerProxy.getBalance()}์\n`); // ์ฑ๊ณตconst strangerProxy = new BankAccountProxy(account, 'ํ๊ธธ๋');strangerProxy.getBalance(); // ์คํจ (๊ถํ ์์) ํ๊ธธ๋ != ๊น์ฒ ์์ด๊ธฐ ๋๋ฌธ.3. Remote Proxy(์๊ฒฉ ํ๋ก์, ๋คํธ์ํฌ ์์)

ํ๋ก์๊ฐ ์ค๊ฐํ ๋์ ๊ฐ์ฒด(RealSubject)๊ฐ ๋ค๋ฅธ ๊ณต๊ฐ(๋คํธ์ํฌ)์ ์กด์ฌํ๋ ๊ฒฝ์ฐ์ ์ฃผ๋ก ์ฌ์ฉํด์. ์ ํด๋์ค ๋ค์ด์ด๊ทธ๋จ์ ์ฌ์ค ๋ง์ด ์๋๋ ๋ค์ด์ด๊ทธ๋จ ์ด์์. ํ์ง๋ง ๊ตณ์ด ์ ๊ทธ๋ฆผ์ ์ฌ์ฉํ ์ด์ ๋ Client Proxy์ Server Proxy๋ฅผ ํตํด์ Server-Client๊ฐ์ ๋คํธ์ํฌ ์์์ ํ๊ณ ์๋ค๋ ๊ฒ์ ๋ํ๋ด๊ณ ์ถ์์ด์.

์ํ์ค ๋ค์ด์ด๊ทธ๋จ์ ํตํด์ ๋ณด๋ฉด ํด๋ผ์ด์ธํธ๋ ์๋ฒ๋ ๊ฒฐ๊ตญ Subject ์ธํฐํ์ด์ค๋ฅผ ๋ฐ๋ผ ์ฌ์ฉํ๋ค๋ ๊ฒ์ ์ ์ ์์ด์. ๋ค๋ง ์ค๊ฐ์ Proxy๊ฐ ์ถ๊ฐ๋์ด ๋คํธ์ํฌ ํต์ ์ ํ์ฌ ๋ค๋ฅธ ๊ณต๊ฐ์ ๊ฐ์ฒด๋ฅผ ์ฌ์ฉํ ์ ์๊ฒ ๋๊ฑฐ์์
// ์๊ฒฉ ํ๋ก์ (Remote Proxy)// ์๊ฒฉ ์๋ฒ์ ๋ฆฌ์์ค๋ฅผ ๋ก์ปฌ์ ์๋ ๊ฒ์ฒ๋ผ ์ฌ์ฉclass ImageService { loadImage(imageId) { console.log(`[์ค์ ์๋ฒ] ์ด๋ฏธ์ง ${imageId} ๋ก๋ฉ ์ค...`); // ์ค์ ๋ก๋ fetch ๋ฑ์ผ๋ก ์๋ฒ์ ํต์ return `image_data_${imageId}`; }}class ImageServiceProxy { constructor() { this.imageService = new ImageService(); } loadImage(imageId) { console.log(`[ํ๋ก์] ์ด๋ฏธ์ง ${imageId} ์์ฒญ ๋ฐ์`); // ์๊ฒฉ ์๋ฒ์ ์์ฒญ console.log(`[ํ๋ก์] ์๋ฒ์ ์์ฒญ ์ ๋ฌ`); const imageData = this.imageService.loadImage(imageId); return imageData; }}ํ๋ก์ ํจํด ์์ - ์๋ํฐ์ ์ด๋ฏธ์ง ์ ๋ก๋
์๋ํฐ์ ์ด๋ฏธ์ง ํ์ผ ๋๋ URL์ ๋ฃ์ผ๋ฉด ์ด๋ฏธ์ง๋ฅผ ์๋ํฐ์์ ๋ณด์ฌ์ฃผ๋ ๊ธฐ๋ฅ์ด ์ด๋ฏธ ์๋ค๊ณ ๊ฐ์ ํด์. ๊ทธ๋ฐ๋ฐ ํ์ผ์ ๋ฃ์ด์ ์ด๋ฏธ์ง๋ฅผ ๋ณด์ฌ์ฃผ๋ ๊ฒฝ์ฐ์๋ ์ด๋ฏธ์ง ํ์ผ์ ์๋ฒ์ ์ ๋ก๋๊น์ง ํ๋ ๊ธฐ๋ฅ์ด ํ์ํ๊ณ , ํน์ ํ์ฅ์์ ์ด๋ฏธ์ง๋ง ๋ณด์ฌ์ค ์ ์๋๋ก ๋ง๋ค๊ณ ์ถ๋ค๋ ์๊ตฌ์ฌํญ์ด ์๊ฒผ์ด์. ์ด๊ฑธ ํ๋ก์๋ฅผ ์ถ๊ฐํ์ฌ ํด๊ฒฐํ ๊ฒฝ์ฐ ์๋์ ๊ฐ์ ์ฝ๋๊ฐ ๋์ฌ ๊ฒ ๊ฐ์์.
// Client ์ฝ๋, Config๋ฅผ ํตํด ์ด๋ฏธ์ง ์
๋ก๋ ์ธ๋ถ ์ค์ .const newEditor = createEditor({ uploadConfig: { uploadUrl: 'https://api.example.com/upload', allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'], maxFileSize: 2 * 1024 * 1024, onUploadStart: () => { setUploading(true); addLog('ํ์ผ ์
๋ก๋ ์์...', 'info'); }, onUploadSuccess: (url) => { setUploading(false); addLog(`์
๋ก๋ ์ฑ๊ณต: ${url}`, 'success'); }, onUploadError: (error) => { setUploading(false); addLog(`์
๋ก๋ ์คํจ: ${error}`, 'error'); } }});// ์๋ํฐ ์์ฑ ํจ์function createEditor(options = {}) { let imageHandler = new BasicImageHandler(); imageHandler = new ImageUploadProxy(options.uploadConfig, imageHandler); return new Editor(imageHandler);}// ๊ธฐ๋ณธ ์ด๋ฏธ์ง ํธ๋ค๋ฌclass BasicImageHandler { async handle(input) { console.log('[BasicHandler] input ๋ฐ์:', input instanceof File ? input.name : input); // URL์ด๋ฉด ๊ทธ๋๋ก ๋ฐํ if (typeof input === 'string') { console.log('[BasicHandler] URL ๊ทธ๋๋ก ๋ฐํ'); return input; } // File์ด๋ฉด ๋ฐ์ดํฐ URL๋ก ๋ณํํด์ ๋ฐํ if (input instanceof File) { console.log('[BasicHandler] File์ ๋ฐ์ดํฐ URL๋ก ๋ณํ'); return await this.fileToDataUrl(input); } throw new Error('์ง์ํ์ง ์๋ ์
๋ ฅ ํ์
์
๋๋ค'); }}// ์ด๋ฏธ์ง ์
๋ก๋ ํ๋ก์class ImageUploadProxy { constructor(config, baseHandler) { this.config = config; this.baseHandler = baseHandler; // ํ๋ก์ ํต์ฌ: ๊ธฐ๋ณธ ํธ๋ค๋ฌ๋ฅผ ๊ฐ์! } async handle(input) { console.log('[Proxy] input ๋ฐ์:', input instanceof File ? input.name : input); // File์ด๋ฉด ์
๋ก๋ ์ฒ๋ฆฌ if (input instanceof File) { console.log('[Proxy] File ์
๋ก๋ ์์'); // ๊ฒ์ฆ if (!this.validateFile(input)) { throw new Error('ํ์ผ ๊ฒ์ฆ ์คํจ'); } try { this.config.onUploadStart?.(); // ์
๋ก๋ํด์ URL ํ๋ const url = await this.uploadToServer(input); console.log('[Proxy] ์
๋ก๋ ์๋ฃ, URL์ baseHandler์๊ฒ ์ ๋ฌ:', url); this.config.onUploadSuccess?.(url); // baseHandler์๊ฒ URL ์ ๋ฌ (ํ๋ก์ ํจํด ํต์ฌ!) return await this.baseHandler.handle(url); } catch (error) { console.error('[Proxy] ์
๋ก๋ ์คํจ:', error); this.config.onUploadError?.(error.message); throw error; } } // URL์ด๋ฉด ๊ทธ๋ฅ baseHandler์๊ฒ ๋ฐ๋ก ์ ๋ฌ console.log('[Proxy] URL์ด๋ฏ๋ก baseHandler์๊ฒ ๋ฐ๋ก ์ ๋ฌ'); return await this.baseHandler.handle(input); } validateFile(file) { const { allowedExtensions, maxFileSize } = this.config; const extension = file.name.split('.').pop().toLowerCase(); if (!allowedExtensions.includes(extension)) { const error = `์ง์ํ์ง ์๋ ํ์ผ ํ์์
๋๋ค. (์ง์: ${allowedExtensions.join(', ')})`; this.config.onUploadError?.(error); return false; } if (file.size > maxFileSize) { const error = `ํ์ผ ํฌ๊ธฐ๊ฐ ๋๋ฌด ํฝ๋๋ค. (์ต๋: ${maxFileSize / 1024 / 1024}MB)`; this.config.onUploadError?.(error); return false; } console.log('[Proxy] ํ์ผ ๊ฒ์ฆ ํต๊ณผ'); return true; } async uploadToServer(file) { return new Promise((resolve) => { setTimeout(() => { const mockUrl = `${this.config.uploadUrl}/images/${Date.now()}_${file.name}`; resolve(mockUrl); }, 1500); }); }}ํ๋ก์ ํจํด์ ์ฅ๋จ์
ํ๋ก์ ํจํด์ ๊ธฐ์กด ๊ฐ์ฒด๋ฅผ ๊ฑด๋๋ฆฌ์ง ์๊ณ ๊ธฐ๋ฅ์ ์ถ๊ฐํ๊ธฐ ์ข์์. ๊ทธ๋์ ๋ฐ์ฝ๋ ์ดํฐ ํจํด๊ณผ ๊ฐ๋ค๊ณ ์๊ฐํ ์ ์์ด์. ๋ฐ์ฝ๋ ์ดํฐ ํจํด์ ๊ฐ์ฒด์ ์๋ ๊ธฐ๋ฅ์ ์ ์งํ๋ฉด์ ์ฌ๋ฌ ์ถ๊ฐ ๊ธฐ๋ฅ์ ๋์ ์ผ๋ก ์ถ๊ฐํ๋ ๊ฒ์ด ์ฃผ ๋ชฉ์ ์ด์์. ํ์ง๋ง ํ๋ก์ ํจํด์ ๊ฐ์ฒด์ ์ ๊ทผ์ ๋ํ ์ ์ด๊ฐ ์ฃผ ๋ชฉ์ ์ด๊ณ ๋ณดํต ์ฌ๋ฌ ๊ฒน์ผ๋ก ๊ฐ์ธ์ ์ฌ์ฉํ์ง ์์์.
์ด์ ํ๋ก์ ํจํด์ ์ฅ๋จ์ ์ ๋ํด์ ์์๋ด์.
์ฅ์
๋จ์ผ ์ฑ ์ ์์น(SRP)์ ๋ ์ ์งํฌ ์ ์๋ค.(RealObject์ ์ถ๊ฐ์ ์ธ ์ ๊ทผ ์ ์ด ์ฝ๋ ๋ฑ์ด ๋ค์ด๊ฐ์ง ์์)
๊ฐ๋ฐฉ ํ์ ์์น(OCP)์ ๋ ์ ์งํฌ ์ ์๋ค.(RealObject ์ฝ๋ ์์ ์์ด Proxy๋ฅผ ์ถ๊ฐํ์ฌ ์ ๊ทผ ์ ์ด ๊ธฐ๋ฅ์ ๋ํ๋ค.)
์ ๊ทผ ์ ์ด๋ฟ๋ง์ด ์๋๋ผ, RealObject์ ํจ์ ์คํ ์ ํ, ์คํจ ์ฌ๋ถ ๋ฑ์ ๋ก๊น ์ด๋ ์บ์ฑ ๋ฑ์ ๋ถ๊ฐ์์ ์๋ ์ข๋ค.
๋จ์
ํ๋ก์๊ฐ ์ถ๊ฐ๋๋ฉฐ ํ๋ก์ ๋ด๋ถ์ ์ฝ๋ ๊ตฌํ์ ์ํด์๋ผ๋ ์ฝ๋์์ด ๋ฐฉ๋ํด์ง๋ค.
ํ๋ก์๋ฅผ ์ฌ์ฉํ๋ ๊ฐ์ฒด(์ธ์คํด์ค)๊ฐ ๋ง์ด ์์ฑ๋๋ฉด ์ฑ๋ฅ ๋ฌธ์ ๊ฐ ์๊ธธ ์ ์๋ค.
๋ง๋ฌด๋ฆฌ
ํ๋ก์ ํจํด์ ๊ฐ์ฒด์ ๋ํ ์ ๊ทผ์ ์ ์ดํ๊ธฐ ์ํ ๊ฐ๋ ฅํ ๋์์ธ ํจํด์ด์์. ํต์ฌ์ ๊ธฐ์กด ๊ฐ์ฒด๋ฅผ ์์ ํ์ง ์๊ณ ๋ ๋ถ๊ฐ์ ์ธ ๊ธฐ๋ฅ์ ์ถ๊ฐํ ์ ์๋ค๋ ์ ์ด์์.
๊ฐ๋ฐฉ-ํ์ ์์น(OCP)๊ณผ ๋จ์ผ ์ฑ ์ ์์น(SRP)์ ์งํค๋ฉด์ ๊ฐ์ฒด์ ์ ๊ทผ์ ์ ์ดํ ์ ์๊ฒ ํด์ค์ ๊ธฐ์กด ์ฝ๋๋ฅผ ๊ฑด๋๋ฆฌ์ง ์๊ณ ๋ ๊ฒ์ฆ, ๋ก๊น , ์บ์ฑ ๋ฑ์ ๊ธฐ๋ฅ์ ์ถ๊ฐํ ์ ์์ด์ ์ ์ง๋ณด์์ฑ์ด ์ข์์. ๋ค๋ง ํ๋ก์๊ฐ ๋ง์์ง๋ฉด ์ฝ๋๊ฐ ๋ณต์กํด์ง๊ณ ์ฑ๋ฅ ๋ฌธ์ ๊ฐ ์๊ธธ ์ ์์ผ๋, ์ ๋ง ํ์ํ ๊ณณ์๋ง ์ฌ์ฉํ๋ ๊ฒ์ด ์ข์์. ํ๋ก ํธ์๋์์ React์ ๊ฒฝ์ฐ์๋ Suspense ์ปดํฌ๋ํธ๊ฐ ํ๋ก์ ์ญํ ์ ํ๋ค๊ณ ๋ณผ ์ ์์ด์.
๋ง์ฝ ์ฌ๋ฌ๋ถ์ด ๊ฐ์ฒด์ ์ ๊ทผ์ ์ ์ดํ๊ณ ์ถ์ผ๋ฉด ํ๋ก์ ํจํด์ ์ฌ์ฉ์ ๊ณ ๋ คํด๋ณด์ธ์. ๋ฌผ๋ก ์ธ์ ๋ ์ค๋ฒ ์์ง๋์ด๋ง์ธ์ง ์๊ฐํด ๋ณด์๊ณ ์!
