"Vuex strict 모드"의 두 판 사이의 차이

(새 문서: ==개요== ;Vuex strict 모드 ;Vuex 엄격 모드 * strict 모드를 사용하려면 <code>strict: true</code>를 Vuex 저장소를 만들 때 추가하면 된다. * production 에...)
 
잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
 
(다른 사용자 한 명의 중간 판 하나는 보이지 않습니다)
2번째 줄: 2번째 줄:
;Vuex strict 모드
;Vuex strict 모드
;Vuex 엄격 모드
;Vuex 엄격 모드
* strict 모드를 사용하려면 <code>strict: true</code>를 Vuex 저장소를 만들 때 추가하면 된다.
* strict 모드를 활성화하려면, Vuex 저장소를 만들 때 <code>strict: true</code>를 추가하면 된다.
* production 에서는 strict 모드를 사용하지 말자. ★


<source lang='javascript'>
<syntaxhighlight lang='javascript'>
const store = new Vuex.Store({
const store = new Vuex.Store({
   // ...
   // ...
   strict: true
   strict: true
})
})
</source>
</syntaxhighlight>
<source lang='javascript'>
* strict 모드에서는 Vuex 상태가 변이 핸들러 외부에서 변이될 때마다 오류가 발생한다.
* 이렇게 하면 디버깅 도구에서 모든 상태 변이를 명시적으로 추적할 수 있다.
 
==개발 vs. 배포==
* production 배포시에는 strict 모드를 활성화하지 말자. ★
* strict 모드는 부적절한 변이를 감지하기 위해 상태 트리를 자세히 관찰한다.
* production 환경에서는 성능 저하를 막기 위해 끄도록 하자.
 
* 플러그인과 마찬가지로, 빌드 도구가 그것을 처리하도록 할 수 있다.
<syntaxhighlight lang='javascript'>
const store = new Vuex.Store({
const store = new Vuex.Store({
   // ...
   // ...
   strict: process.env.NODE_ENV !== 'production'
   strict: process.env.NODE_ENV !== 'production'
})
})
</source>
</syntaxhighlight>


==참고==
==참고==
* https://vuex.vuejs.org/guide/strict.html
* https://vuex.vuejs.org/kr/guide/strict.html
* https://vuex.vuejs.org/kr/guide/strict.html


[[분류: Vuex]]
[[분류: Vuex]]

2020년 11월 2일 (월) 02:54 기준 최신판

1 개요[ | ]

Vuex strict 모드
Vuex 엄격 모드
  • strict 모드를 활성화하려면, Vuex 저장소를 만들 때 strict: true를 추가하면 된다.
const store = new Vuex.Store({
  // ...
  strict: true
})
  • strict 모드에서는 Vuex 상태가 변이 핸들러 외부에서 변이될 때마다 오류가 발생한다.
  • 이렇게 하면 디버깅 도구에서 모든 상태 변이를 명시적으로 추적할 수 있다.

2 개발 vs. 배포[ | ]

  • production 배포시에는 strict 모드를 활성화하지 말자. ★
  • strict 모드는 부적절한 변이를 감지하기 위해 상태 트리를 자세히 관찰한다.
  • production 환경에서는 성능 저하를 막기 위해 끄도록 하자.
  • 플러그인과 마찬가지로, 빌드 도구가 그것을 처리하도록 할 수 있다.
const store = new Vuex.Store({
  // ...
  strict: process.env.NODE_ENV !== 'production'
})

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}