Challenge - 5 Problems
SSR vs CSR Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1:30remaining
Understanding Server-Side Rendering (SSR) vs Client-Side Rendering (CSR)
Which statement best describes the main difference between SSR and CSR in Angular applications?
Attempts:
2 left
💡 Hint
Think about where the first HTML content is created: server or browser.
✗ Incorrect
SSR means the server creates the HTML before sending it to the browser, so users see content faster. CSR means the browser builds the HTML after downloading JavaScript.
❓ component_behavior
intermediate1:30remaining
Behavior of Angular Components in SSR vs CSR
In an Angular app using SSR, what happens to component lifecycle hooks like ngOnInit during server rendering?
Attempts:
2 left
💡 Hint
Consider when Angular runs component code during server rendering.
✗ Incorrect
During SSR, Angular runs component lifecycle hooks like ngOnInit on the server to prepare data before sending HTML. This helps show ready content immediately.
❓ state_output
advanced2:00remaining
State Transfer Between SSR and CSR in Angular
Consider an Angular app using SSR with state transfer. After server rendering, what happens to the application state when the client bootstraps?
Attempts:
2 left
💡 Hint
Think about how SSR can improve client startup performance.
✗ Incorrect
Angular's state transfer mechanism passes data fetched during SSR to the client, so the client can reuse it and avoid extra network calls.
📝 Syntax
advanced2:00remaining
Identifying SSR-Compatible Angular Code
Which Angular code snippet is NOT compatible with SSR and will cause errors during server rendering?
Angular
import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-example', template: `<p>{{message}}</p>` }) export class ExampleComponent implements OnInit { message = ''; ngOnInit() { this.message = window.navigator.userAgent; } }
Attempts:
2 left
💡 Hint
Remember that some browser APIs do not exist on the server.
✗ Incorrect
Accessing window or browser-only objects during SSR causes errors because the server environment lacks these APIs.
🔧 Debug
expert2:30remaining
Debugging Hydration Mismatch in Angular SSR
An Angular SSR app shows a hydration mismatch warning in the browser console after loading. Which cause is most likely responsible?
Attempts:
2 left
💡 Hint
Hydration mismatch means the browser sees different HTML than expected from the client app.
✗ Incorrect
Hydration mismatch happens when the HTML generated on the server does not match what the client app expects, often due to differing initial data or state.