Challenge: Constant Types
Practice what we've learned about constant types.
We'll cover the following
Problem statement
Using strings for getters, actions, and mutations can be error-prone. It’s a common practice to use constants instead because they make it easier to determine which getters, actions, and mutations are possible. Moreover, constants also allow code to take advantage of linters and they help prevent accidental typos.
Challenge
Your task is to replace the property names of getters, actions, and mutations with constant types in the src/store/modules/todos/todos.js
file. The types should be created and exported in the src/store/modules/todos/todosTypes.js
file and then imported in todos.js
and App.vue
. You’ll also need to update the mapping helpers in the App.vue
component to take advantage of the constant types.
Get hands-on with 1200+ tech skills courses.