Challenge - 5 Problems
Fresh Islands Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediateHow does an island component behave in Fresh?
In Fresh, what happens when an island component is rendered on the client side?
Consider that the island is a small interactive part of a mostly static page.
Consider that the island is a small interactive part of a mostly static page.
Attempts:
2 left
💡 Hint
Think about how islands isolate interactivity to small parts of the page.
✗ Incorrect
In Fresh, island components hydrate only themselves on the client, enabling interactivity without reloading or re-rendering the whole page. This keeps the page fast and efficient.
📝 Syntax
intermediateCorrect syntax to define an island component in Fresh
Which of the following code snippets correctly defines an island component in Fresh using Deno?
Attempts:
2 left
💡 Hint
Look for the standard way to export a component with hooks in Fresh.
✗ Incorrect
In Fresh, island components are just default exported functions using hooks like useState. No special export like ISLAND is needed.
❓ state_output
advancedState behavior in nested island components
Given two nested island components in Fresh, Parent and Child, where Child has its own state counter and Parent renders Child, what happens when Child's button is clicked?
Deno
function Child() {
const [count, setCount] = useState(0);
return <button onClick={() => setCount(count + 1)}>Child count: {count}</button>;
}
function Parent() {
return <div><Child /></div>;
}Attempts:
2 left
💡 Hint
Think about how islands isolate state and rendering.
✗ Incorrect
In Fresh, each island manages its own state independently. Updating Child's state only re-renders Child, not Parent.
🔧 Debug
advancedIdentify the cause of hydration failure in a Fresh island
A developer notices that their island component in Fresh does not hydrate on the client and remains static. Which of the following is the most likely cause?
Attempts:
2 left
💡 Hint
Consider what prevents client-side JavaScript from running.
✗ Incorrect
Using server-only APIs inside an island component causes hydration to fail because those APIs cannot run in the browser.
🧠 Conceptual
expertWhy does Fresh use islands architecture instead of full client-side rendering?
What is the main advantage of using islands architecture in Fresh compared to rendering the entire page as a single client-side app?
Attempts:
2 left
💡 Hint
Think about how islands affect JavaScript size and page speed.
✗ Incorrect
Islands architecture hydrates only small interactive parts, reducing JavaScript sent and improving performance compared to full client-side apps.
