0
0
Vueframework~20 mins

How Vue differs from React and Angular - Practice Exercises

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Vue Mastery Challenge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Vue's approach to component structure
Which statement best describes how Vue's component structure differs from React and Angular?
AVue components must be written in TypeScript, unlike React and Angular which allow JavaScript.
BVue requires class-based components like Angular, while React uses only functional components.
CVue uses a single-file component format combining template, script, and style, unlike React's JSX and Angular's separate files.
DVue does not support reactive data binding, unlike React and Angular.
Attempts:
2 left
💡 Hint
Think about how Vue files group code compared to React and Angular.
component_behavior
intermediate
2:00remaining
Reactivity system differences
What is a key difference in how Vue's reactivity system works compared to React and Angular?
AVue requires manual DOM updates, unlike React and Angular which update automatically.
BVue uses proxies to track changes reactively, while React relies on state hooks and Angular uses zones for change detection.
CVue does not support reactive data, unlike React and Angular.
DVue uses a virtual DOM like Angular but not like React.
Attempts:
2 left
💡 Hint
Consider how Vue tracks data changes internally.
📝 Syntax
advanced
2:00remaining
Vue Composition API syntax
Which Vue 3 Composition API code snippet correctly creates a reactive counter and increments it on button click?
Vue
import { ref } from 'vue';

export default {
  setup() {
    const count = ref(0);
    function increment() {
      count.value++;
    }
    return { count, increment };
  }
}
A
const count = ref(0);
function increment() {
  count.value++;
}
return { count, increment };
B
const count = ref(0);
function increment() {
  count++;
}
return { count, increment };
C
const count = reactive(0);
function increment() {
  count++;
}
return { count, increment };
D
const count = ref(0);
function increment() {
  count += 1;
}
return { count, increment };
Attempts:
2 left
💡 Hint
Remember how to update a ref's value in Vue 3.
lifecycle
advanced
2:00remaining
Vue lifecycle hooks vs React and Angular
Which statement correctly compares Vue's lifecycle hooks with React's and Angular's?
AVue's lifecycle hooks run only once per app, unlike React and Angular which run per component.
BVue does not have lifecycle hooks, unlike React and Angular.
CVue's created hook runs after the component is destroyed, unlike React's componentDidMount.
DVue's mounted hook runs after the component is added to the DOM, similar to React's useEffect with empty dependencies and Angular's ngAfterViewInit.
Attempts:
2 left
💡 Hint
Think about when the component is fully ready in each framework.
🔧 Debug
expert
3:00remaining
Identifying Vue reactivity bug
Given this Vue 3 Composition API code, what error or issue will occur when clicking the button to increment the count?
import { reactive } from 'vue';

export default {
  setup() {
    const state = reactive({ count: 0 });
    function increment() {
      state.count++;
    }
    return { state, increment };
  }
}
Options:
ANo error; count increments and updates the UI correctly.
BTypeError because reactive objects cannot be mutated directly.
CThe UI does not update because reactive does not track nested properties.
DSyntaxError due to missing ref usage.
Attempts:
2 left
💡 Hint
Consider how Vue 3 reactive works with objects and nested properties.