Challenge - 5 Problems
Fresh Project Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediateWhat is the output of this Fresh component?
Consider this Fresh component code. What will it render in the browser?
Deno
import { h } from "https://esm.sh/preact@10.11.0"; export default function Greeting() { const name = "Fresh"; return <h1>Hello, {name}!</h1>; }
Attempts:
2 left
💡 Hint
Look at how JSX expressions inside curly braces are rendered.
✗ Incorrect
The component returns an h1 element with the text 'Hello, Fresh!'. JSX expressions inside curly braces are evaluated and rendered as text.
📝 Syntax
intermediateWhich option correctly initializes a new Fresh project?
You want to create a new Fresh project using the official command. Which command is correct?
Attempts:
2 left
💡 Hint
Check the official Fresh documentation for the exact command syntax.
✗ Incorrect
The correct command to initialize a new Fresh project is 'deno run -A https://fresh.deno.dev my-app'. The project name is provided as a positional argument.
🔧 Debug
advancedWhy does this Fresh project fail to start?
You ran 'deno task start' in your Fresh project but got an error. What is the likely cause?
Deno
import { start } from "$fresh/server.ts"; import manifest from "./fresh.gen.ts"; await start(manifest);
Attempts:
2 left
💡 Hint
Deno requires explicit permissions for network access.
✗ Incorrect
Deno requires the '-A' flag (all permissions) to allow network access. Without it, the server cannot start and throws a permission error.
❓ state_output
advancedWhat is the output after clicking the button in this Fresh component?
This Fresh component uses state. What will the displayed count be after clicking the button twice?
Deno
import { h } from "https://esm.sh/preact@10.11.0"; import { useState } from "https://esm.sh/preact@10.11.0/hooks"; export default function Counter() { const [count, setCount] = useState(0); return ( <> <p>Count: {count}</p> <button onClick={() => setCount(count + 1)}>Increment</button> </> ); }
Attempts:
2 left
💡 Hint
Each click increases count by 1 starting from 0.
✗ Incorrect
The initial count is 0. Each button click adds 1. After two clicks, count is 2.
🧠 Conceptual
expertWhich statement best describes Fresh's rendering approach?
Fresh uses a unique rendering strategy compared to other frameworks. Which option correctly describes it?
Attempts:
2 left
💡 Hint
Think about how Fresh optimizes loading and interactivity.
✗ Incorrect
Fresh renders pages on the server and sends minimal JavaScript to hydrate only interactive components, improving performance and reducing load times.
