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
442
2
todos 질문입니다.
0
308
2
작동은 되긴 하는데 해당 메세지는 왜 뜨는걸까요?
1
386
0
강의노트 문의
0
385
1
x-total-count 및 db.json id값 문제
0
930
1
개발툴 글자체, 크기, 색깔 세팅 문의
0
236
1
onMount 관련 강의가 몇강에 있었죠?ㅠㅠ
0
322
1
json server실행/중지 문의드립니다!
0
494
1
3:53 분에 HelloWorld 태그 인식을 못해서 오류 발생하비낟!
0
475
1
Composition API?
0
399
1
24강에서 computed의 종속성이 변경도록 return하는데, 그러면 computed가 다시 실행되나요?
0
412
1
구조가 다름...
0
496
1
59강 API body 질문입니다.
0
312
1
로그인과 같이 레이아웃이 완전 다른 페이지를 만들때는 router 를 어떻게 할까요?
0
447
1
vue CLI 설치 관련 문의드립니다.
0
604
1
31강 DB질문
0
429
1
to와 :to의 차이점
0
467
1
52강의 originalTpdp ref 와 todo ref
0
564
1
delete todo 함수를 prop으로 내려주지 않는 이유는 무엇인가요??
0
421
1
computed 와 검색 기능 추가 질문드려요.
0
456
1
[33강] pagination2 numberOfPages 호출
0
393
1
리렌더링 관련 질문
0
344
1
배포 관련 질문드립니다.
0
317
1
30강 질문드립니다.
0
234
1





