useContext가 deprecated 경고가 나오는데 대신 쓸수있는게 있나요?
221
작성한 질문수 1
강의중 나오는 useContext를 이용해 emit을 가져오는 코드가
크롬 콘솔창에서 경고가 아래와 같이 나오네요
runtime-core.esm-bundler.js?5c40:38 [Vue warn]: `useContext()` has been deprecated and will be removed in the next minor release. Use `useSlots()` and `useAttrs()` instead.
useContext()이 deprecated 된다고 나오는데 useContext대신 useSlots(), useAttrs()을 어떻게 활용해야는지 궁금합니다.
답변 1
0
useContext가 Deprecated가 되네요
setup(props, {emit}) 이렇게 쓰시거나
useContext 부분에 getCurrentInstance를 사용하시면 되네요
<script>
import { getCurrentInstance } from 'vue';
export default {
props: {
numberOfPages: {
type: Number,
required: true
},
currentPage: {
type: Number,
required: true
}
},
emits: ['click'],
setup() {
const { emit } = getCurrentInstance();
const onClick = (page) => {
emit('click', page)
};
return {
onClick
}
}
}
</script>
numberOfPages 결과 nan
0
426
2
todos 질문입니다.
0
294
2
작동은 되긴 하는데 해당 메세지는 왜 뜨는걸까요?
1
372
0
강의노트 문의
0
377
1
x-total-count 및 db.json id값 문제
0
921
1
개발툴 글자체, 크기, 색깔 세팅 문의
0
225
1
onMount 관련 강의가 몇강에 있었죠?ㅠㅠ
0
309
1
json server실행/중지 문의드립니다!
0
484
1
3:53 분에 HelloWorld 태그 인식을 못해서 오류 발생하비낟!
0
469
1
Composition API?
0
396
1
24강에서 computed의 종속성이 변경도록 return하는데, 그러면 computed가 다시 실행되나요?
0
401
1
구조가 다름...
0
487
1
59강 API body 질문입니다.
0
301
1
로그인과 같이 레이아웃이 완전 다른 페이지를 만들때는 router 를 어떻게 할까요?
0
439
1
vue CLI 설치 관련 문의드립니다.
0
591
1
31강 DB질문
0
419
1
to와 :to의 차이점
0
450
1
52강의 originalTpdp ref 와 todo ref
0
555
1
delete todo 함수를 prop으로 내려주지 않는 이유는 무엇인가요??
0
412
1
computed 와 검색 기능 추가 질문드려요.
0
446
1
[33강] pagination2 numberOfPages 호출
0
381
1
리렌더링 관련 질문
0
337
1
배포 관련 질문드립니다.
0
312
1
30강 질문드립니다.
0
222
1





