Build a Habit Tracker React App
0/9 steps0%

Step 2 of 9

Implement real habit state and habit creation

Allow users to add habits through a working form with validation.

Creation is the first proof that the app is truly interactive.

First time here? Paste the Context Pack first so the AI understands your project - open it from the header above.

Prompt Capsule
Add working habit state in the React app using useState. Connect the HabitForm so a user can type a habit name and submit it to create a new habit object with a unique id, name, createdAt timestamp, and empty completions array. Trim whitespace, reject empty names, clear the input after successful submit, and display a validation message for invalid submissions.
Paste into EmergentFull Build: complete implementation prompt with explicit requirements

Quick is short. Full Build is recommended for most steps. Strict forces real logic when the AI keeps faking output.

Actual change check

Expected after this step

Users can add habits through the form and see them appear immediately in the list.

Should NOT happen

  • An existing feature broke
  • A button only logs to console
  • Data disappears after refresh
  • Errors fail silently with no visible state

This is what should exist before you continue. If reality does not match, do not move on.

Track what changed, failed, or needs follow-up. Notes export with the flow.

Made with Emergent