Recall & Review
beginner
What does 'sharing state between framework islands' mean in Astro?
It means passing data or state between different UI parts built with different frameworks inside an Astro page, so they can work together smoothly.
Click to reveal answer
beginner
Why is sharing state between framework islands challenging?
Because each island is its own mini app with separate JavaScript, so they don't automatically share data or updates without extra setup.
Click to reveal answer
intermediate
Name one common method to share state between framework islands.
Using a global state manager or a shared event system like custom events or browser storage to communicate between islands.
Click to reveal answer
intermediate
How can custom events help in sharing state between islands?
One island can dispatch a custom event with data, and another island listens for that event to update its state accordingly.
Click to reveal answer
beginner
What is a practical example of sharing state between framework islands?
A shopping cart island updates when a product island adds an item, so the cart shows the new total without reloading the page.
Click to reveal answer
What is a 'framework island' in Astro?
✗ Incorrect
A framework island is a self-contained UI piece built with React, Vue, Svelte, etc., inside Astro.
Which of these is NOT a way to share state between islands?
✗ Incorrect
Global variables alone don't work well because islands run isolated scripts.
Why might you use browser storage to share state?
✗ Incorrect
Browser storage like localStorage can hold data accessible by all islands on the page.
What role do custom events play in state sharing?
✗ Incorrect
Custom events allow islands to communicate by sending and receiving data messages.
Which is a benefit of sharing state between framework islands?
✗ Incorrect
Sharing state helps islands update together, making the UI feel smooth and connected.
Explain how you can share state between two different framework islands in Astro.
Think about how one island can tell another about a change.
You got /3 concepts.
Describe a real-life scenario where sharing state between framework islands improves user experience.
Imagine a shopping site with multiple parts updating together.
You got /3 concepts.