๐Ÿ“šย Reference


๐Ÿ“œย Chapter


Reactivity (๋ฐ˜์‘์„ฑ)

ref, reactive

toRefs()


ํ•„์š”ํ•œ ์ด์œ 


const state = reactive({ count: 0 });

// โŒ ๋ฐ˜์‘์„ฑ ์ƒ์‹ค: ์ด์ œ 'count'๋Š” ๊ทธ๋ƒฅ ์ˆซ์ž 0์ผ ๋ฟ, state.count๊ฐ€ ๋ณ€ํ•ด๋„ ๋ฐ”๋€Œ์ง€ ์•Š๋Š”๋‹ค.
let { count } = state; 

// โœ… ๋ฐ˜์‘์„ฑ ์œ ์ง€: toRefs๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด 'count'๋Š” 'state.count'๋ฅผ ๋ฐ”๋ผ๋ณด๋Š” 'ref'๊ฐ€ ๋œ๋‹ค.
const { count } = toRefs(state);