0
0
Reactframework~20 mins

React ecosystem overview - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
React Ecosystem Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding React Server Components
Which statement best describes React Server Components (RSC)?
ARSC are client-side components that fetch data asynchronously after rendering.
BRSC run on the server and send HTML to the client without including JavaScript for those components.
CRSC require class components and lifecycle methods to work properly.
DRSC are deprecated and replaced by traditional React class components.
Attempts:
2 left
💡 Hint
Think about where the component code runs and what is sent to the browser.
component_behavior
intermediate
2:00remaining
Behavior of useState in React 19+
What happens when you call the setter function from useState multiple times synchronously in a React 19+ functional component?
React
const [count, setCount] = useState(0);

setCount(count + 1);
setCount(count + 1);

// What is the value of count after these calls?
Acount will be undefined due to a runtime error.
Bcount will be 2 because each setCount increments count by 1.
Ccount will be 0 because setCount does not update state synchronously.
Dcount will be 1 because both setCount calls use the same initial count value.
Attempts:
2 left
💡 Hint
Remember that state updates are batched and the setter uses the current closure value.
📝 Syntax
advanced
2:00remaining
Correct use of React Context with useContext Hook
Which option correctly shows how to consume a React Context named ThemeContext inside a functional component?
React
const ThemeContext = React.createContext('light');

function MyComponent() {
  // How to get the current theme value?
}
Aconst theme = ThemeContext.useContext();
Bconst theme = React.useContext('ThemeContext');
Cconst theme = useContext(ThemeContext);
Dconst theme = useContext('ThemeContext');
Attempts:
2 left
💡 Hint
Check the correct syntax for useContext hook usage.
🔧 Debug
advanced
2:00remaining
Identifying a React Hook Rules Violation
What error will this React component produce when rendered? function Example() { if (Math.random() > 0.5) { const [count, setCount] = useState(0); } return
Check count
; }
AError: React Hook "useState" is called conditionally, which breaks the rules of hooks.
BNo error; the component renders normally with count state.
CSyntaxError due to missing import of useState.
DRuntime error because count is undefined in the return statement.
Attempts:
2 left
💡 Hint
Hooks must be called unconditionally at the top level of components.
lifecycle
expert
2:00remaining
React 19+ useEffect Behavior with Strict Mode
In React 19+ with Strict Mode enabled, what is the behavior of useEffect cleanup and re-run during development?
AuseEffect cleanup and re-run happen twice on mount to help detect side effects.
BuseEffect runs only once on mount and cleanup runs only on unmount.
CuseEffect runs synchronously blocking rendering in Strict Mode.
DuseEffect cleanup never runs in Strict Mode during development.
Attempts:
2 left
💡 Hint
Strict Mode intentionally double-invokes effects in development.