강의

멘토링

로드맵

Inflearn Community Q&A

tmdals9974's profile image
tmdals9974

asked

Vue.js Intermediate Course - Learn Vue.js, ES6, Vuex by Building a Web App

[Refactoring & Quiz] Applying mapMutations and Quiz

Enhanced Object Literal

Written on

·

377

1

...mapGetters나 ...mapState는 객체리터럴 문법이 적용되는데

...mapMutations는 왜 안되는걸까요?

적용해보고싶어서 TodoList.vue에서 호출하는 이벤트 명과

store Mutations에 있는 function 명을 맞췄는데도 불가능하네요.

객체와 function의 차이인가용..?

es6vuexjavascriptvuejs

Quiz

61% of people got it wrong. Give it a try!

Vuex 헬퍼 함수(mapState, mapGetters, mapMutations, mapActions)를 사용하는 주된 이유는 무엇일까요?

컴포넌트 코드를 더 길게 만들기 위해서

컴포넌트에서 스토어 요소에 더 쉽게 접근하기 위해서

새로운 상태(state) 속성을 정의하기 위해서

비동기 로직을 직접 처리하기 위해서

Answer 2

0

tmdals9974님의 프로필 이미지
tmdals9974
Questioner

링크에 있는 내용대로 진행해보았는데도 에러가 발생합니다!
조언 부탁드립니다 ㅠㅠ
        ...mapMutations({
            'removeItem'
       }), <-- 이 부분에서 에러 발생

0

captain님의 프로필 이미지
captain
Instructor

안녕하세요 승민님, 좋은 질문이네요..! mapMutations도 스프레드 오퍼레이터(spread operator) 문법이 동일하게 적용됩니다. 아래 내용 참고해서 한번 다시 진행해보시겠어요? :)

https://vuex.vuejs.org/guide/mutations.html#committing-mutations-in-components

tmdals9974's profile image
tmdals9974

asked

Ask a question