Challenge - 5 Problems
Vue PWA Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Why is Vue's Composition API beneficial for progressive web apps?
Vue's Composition API helps organize code in progressive web apps by:
Attempts:
2 left
💡 Hint
Think about how code organization helps maintainability in apps.
✗ Incorrect
The Composition API lets developers group related code together, making it easier to manage complex progressive web apps.
❓ component_behavior
intermediate2:00remaining
What happens when a Vue PWA component uses
ref for state?In Vue 3, using
ref inside a PWA component means:Attempts:
2 left
💡 Hint
Remember what reactivity means in Vue.
✗ Incorrect
Using ref creates reactive state that Vue tracks to update the UI when the value changes.
❓ lifecycle
advanced2:00remaining
Which Vue lifecycle hook is best for registering a service worker in a PWA?
To register a service worker in a Vue PWA, you should use the lifecycle hook:
Attempts:
2 left
💡 Hint
Think about when the DOM is ready for service worker registration.
✗ Incorrect
Service workers should be registered after the component is mounted to the DOM, so onMounted is ideal.
📝 Syntax
advanced2:00remaining
What is the correct way to define a reactive object in Vue 3 for PWA state?
Choose the correct syntax to create a reactive object named
user with a name property:Attempts:
2 left
💡 Hint
Reactive objects use reactive(), refs wrap single values.
✗ Incorrect
reactive() creates a reactive object. ref() is for single values, not objects.
🔧 Debug
expert3:00remaining
Why does this Vue PWA component fail to update UI when state changes?
Given this code snippet, why does the UI not update when
count.value changes?
import { ref } from 'vue';
export default {
setup() {
const count = ref(0);
function increment() {
count.value = count.value + 1;
}
return { count, increment };
}
}Attempts:
2 left
💡 Hint
Think about how to update a ref's value properly.
✗ Incorrect
Refs hold their value in .value. Assigning to count replaces the ref, breaking reactivity.