Code Room
Vibe codingHardvc-g248
Subject Ai code reviewLevel Senior~18 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

An AI wrote this React Native multi-step form that saves progress so users don't lose work if the OS kills the backgrounded app. It works when the dev manually navigates back, but real users report their answers are blank after Android kills the app in the background and they reopen it. What's wrong and how would you fix it?

jsx
function Wizard() {  const [data, setData] = useState({});  const update = (k, v) => {    setData({ ...data, [k]: v });    AsyncStorage.setItem('wizard', JSON.stringify(data));   // saves OLD data  };  useEffect(() => {    AsyncStorage.getItem('wizard').then(d => d && setData(d)); // sets a string  }, []);  return <Steps data={data} onChange={update} />;}
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.