[Vue] ref 함수
·
Framework/Vue
ref()반응형 상태(데이터)를 선언하는 함수 (Declaring Reactive State) ref() 사용인자를 받아 .value 속성이 있는 ref 객체로 wrapping하여 반환한다.ref로 선언된 변수의 값이 변경되면 해당 값을 사용하는 템플릿에서 자동으로 업데이트한다.인자는 어떠한 타입도 가능하다.const {createApp, ref } = Vueconst app = createApp({ const message = ref('Hello, Vue!') console.log(message) // ref 객체 console.log(message.value)}) 템플릿 렌더링반환된 객체의 속성은 템플릿에서 사용할 수 있다.Mustache syntax(콧수염 구문)를 사용하여 메시지 ..