tjdud0123 / vue_note

Vue.js 코드 메모
6 stars 2 forks source link

props 내려줄때 주의할점 #11

Open tjdud0123 opened 4 years ago

tjdud0123 commented 4 years ago

관련 에러 Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. 참고 https://vuejs.org/v2/guide/components-props.html?#One-Way-Data-Flow

tjdud0123 commented 4 years ago

object / array reference로 넘어감 ->주의

Note that objects and arrays in JavaScript are passed by reference, so if the prop is an array or object, mutating the object or array itself inside the child component will affect parent state.