A. setValue prop is incorrectly assigned the state value instead of the updater function
B. value state is not initialized properly
C. Child component is missing parentheses
D. React.useState should be React.state
Solution
Step 1: Check props passed to Child
Parent passes value={value} correctly but setValue={value} incorrectly passes the state value instead of the updater function.
Step 2: Understand correct usage
setValue should be passed as setValue={setValue} to allow Child to update state.
Final Answer:
setValue prop is incorrectly assigned the state value instead of the updater function -> Option A
Quick Check:
Updater function must be passed, not state value [OK]
Hint: Pass updater function, not state value, as setState prop [OK]
Common Mistakes:
Confusing state variable with updater function
Forgetting curly braces around variables
Assuming React.useState is incorrect
5. You have two sibling components, InputA and InputB, both need to update and display the same text value. Which pattern correctly lifts state to their parent to keep them in sync?
hard
A. Use local variables in siblings without state
B. Store text state separately in each sibling, update independently
C. Store text state in one sibling and pass it down to the other sibling
D. Store text state in parent, pass text and setText to both siblings as props
Solution
Step 1: Understand shared state need
Both siblings must show and update the same text, so state must be shared.
Step 2: Apply lifting state pattern
Lift text state to their common parent and pass text and setText as props to both siblings.
Step 3: Evaluate other options
Storing state separately or in one sibling breaks sync; local variables don't persist or trigger re-renders.
Final Answer:
Store text state in parent, pass text and setText to both siblings as props -> Option D
Quick Check:
Lift state to parent for shared updates [OK]
Hint: Lift shared state to parent, pass state and updater down [OK]
Common Mistakes:
Keeping separate states in siblings causing out-of-sync
Passing state only one way between siblings
Using local variables instead of state
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.