0
0
Vueframework~20 mins

SSR vs CSR mental model in Vue - Practice Questions

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
SSR vs CSR Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding SSR and CSR rendering timing
In Vue with SSR and CSR, when does the initial HTML content become visible to the user?
ASSR sends fully rendered HTML from the server immediately; CSR renders HTML only after JavaScript loads in the browser.
BCSR sends fully rendered HTML from the server immediately; SSR renders HTML only after JavaScript loads in the browser.
CBoth SSR and CSR send empty HTML and rely on JavaScript to render content after loading.
DSSR and CSR both send fully rendered HTML from the server immediately.
Attempts:
2 left
💡 Hint
Think about which process happens on the server and which happens on the client.
component_behavior
intermediate
2:00remaining
Vue component hydration in SSR
After Vue SSR sends HTML to the browser, what does hydration do?
AHydration disables JavaScript to improve performance.
BHydration reloads the entire page to fetch fresh data from the server.
CHydration attaches Vue's event listeners and makes the static HTML interactive without re-rendering the entire page.
DHydration removes the server-rendered HTML and replaces it with a blank page.
Attempts:
2 left
💡 Hint
Hydration connects static HTML with Vue's dynamic features.
state_output
advanced
2:00remaining
State availability in SSR vs CSR
Consider a Vue app that fetches user data asynchronously. Which statement best describes when the user data is available in SSR vs CSR?
ABoth SSR and CSR include user data in the HTML before sending.
BIn CSR, user data is fetched and included in the HTML before sending; in SSR, data is fetched after the page loads in the browser.
CBoth SSR and CSR fetch user data only after the page loads in the browser.
DIn SSR, user data is fetched and included in the HTML before sending; in CSR, data is fetched after the page loads in the browser.
Attempts:
2 left
💡 Hint
Think about where the data fetching happens in SSR vs CSR.
📝 Syntax
advanced
2:00remaining
Detecting SSR-only code in Vue
Which Vue code snippet correctly runs only during SSR and not in the browser?
Vue
export default {
  setup() {
    if (typeof window === 'undefined') {
      console.log('Running on server')
    }
  }
}
Aif (typeof window !== 'undefined') { console.log('Running on server') }
Bif (typeof window === 'undefined') { console.log('Running on server') }
Cif (window === null) { console.log('Running on server') }
Dif (window) { console.log('Running on server') }
Attempts:
2 left
💡 Hint
Check how to detect server environment in JavaScript.
lifecycle
expert
2:00remaining
Vue lifecycle differences in SSR vs CSR
Which Vue lifecycle hook runs only on the client side and never during SSR?
AonMounted
Bsetup
CbeforeCreate
Dcreated
Attempts:
2 left
💡 Hint
Think about when the DOM is available.