Skip to main content

Using an AI Code Agent to Build a React App

·521 words·3 mins
Markus Bjerrum Jørgensen
Author
Markus Bjerrum Jørgensen
Java developer building fullstack projects with Javalin, PostgreSQL, HTML, CSS, and JavaScript.

Using an AI Code Agent to Build a React App
#

As part of my work with AI-driven applications, I explored how AI code agents can be used in real software development.

The goal was simple: build a small React application where users can answer meditation worksheet questions. The quiz does not require login, but it saves answers locally in the browser so users can return later and review what they wrote.

Instead of building everything manually, I used an AI code agent to help me develop the application.

What is a Code Agent?
#

A code agent is an AI system that can:

  • Read your project files
  • Write and modify code
  • Run commands like build or lint
  • Debug and improve existing code

Unlike normal AI chat, a code agent actively works inside your project.

For this project, I used OpenAI Codex CLI, which runs directly in the terminal and can interact with the codebase.

Workflow: How I Used the Code Agent
#

The process was very different from traditional development.

1. Starting the project
#

I created a basic React project using Vite, then opened it in Codex.

Instead of writing code first, I described what I wanted:

  • A quiz with meditation questions
  • One question at a time
  • Answers saved in localStorage
  • Navigation between questions
  • A review page

2. Letting the agent build
#

The agent:

  • Created a questions data file
  • Replaced the default Vite template :contentReference[oaicite:1]{index=1}
  • Built the quiz logic
  • Implemented localStorage persistence
  • Added navigation and progress tracking
  • Created a review page

It also handled styling and structure, which saved a lot of time.

3. Iterating and refining
#

Instead of just accepting everything, I:

  • Reviewed the generated code
  • Tested the app in the browser
  • Asked the agent to improve parts of the implementation

The agent even:

  • Ran build and lint checks
  • Fixed a persistence issue with localStorage
  • Improved how empty data is handled

This felt more like collaborating with another developer than using a tool.

What I Learned
#

The biggest surprise was how capable the code agent is when given clear instructions.

It didn’t just generate code — it understood the structure of the project, made multiple changes across files, and even verified its own work by running build and lint commands.

That said, it’s not “automatic development”.

I still had to:

  • Guide the agent with clear prompts
  • Understand what it generated
  • Test everything manually
  • Catch potential issues

One small bug or unclear instruction could lead to unexpected results, so staying involved is important.

Another key takeaway is that workflow matters more than tools. The better I described the task, the better the output became.

Conclusion
#

Using a code agent completely changes how development feels.

Instead of writing everything manually, I focused more on:

  • describing features
  • reviewing code
  • testing behavior

The agent handled much of the repetitive work, but I stayed in control of the overall direction.

For this project, it made building a functional React application much faster, while still giving me a good understanding of how everything works.

Overall, it feels less like replacing developers and more like working alongside a very fast assistant.