Using generative AI in writing front end code

Using generative AI in writing front end code

Generative AI, short for Generative Artificial Intelligence, refers to a class of artificial intelligence systems that are designed to generate content, such as text, images, music, or even entire simulations, that is often indistinguishable from content created by humans.

Generative AI can be a very valuable tool for developers when writing code. While we are still far from the day when AI might replace human developers, we are certainly living in an age where programming without AI's help would be considered as archaic as creating websites by hand without using any front-end libraries.

In this post we do a deep dive on state of art in GenAI and how it can help specifically front end engineers.

Table to content

How GenAI helps developers in general.

GenAI is already heavily used by most large companies and software products aimed at developers. Github Copilot, IntelliJ, Github Codespaces, Google IDX and many tools in the market already use AI in their IDEs. But there are some areas where this GenAI is more helpful than others.

Code Auto-Completion

Auto completion is easily one of the most used feature in IDEs these days. As the APIs grow complex, it is harder for humans to remember the API itself. However it is much easier for AI to keep track of the code and autocomplete it by looking at the most common usage in the available code repository.

In the early years the IDEs relied on technologies like Reflection to understand what APIs might be available but these days LLMs do the far better job of generating such suggestions.

Bug Detection

A lot of bugs are due to some common mistakes by programmers. Such as returning the wrong variable, using incorrect bounds, using == where === was appropriate and so on. A good AI is trained on such common pitfalls and can detect them right when developer is typing the code.

Identifying performance impact when you write code

GenAI can be used to detect parts of code that are likely to impact the performance negatively. Things like too much of dom manipulation, needlessly nested DOM elements, inefficient use of CSS rules and so on.

How GenAI can help React developerts

While GenAI is very helpful for all developers, there are some ways it can be even more helpful for the React developers.

Improving accessibility

Accessibility in frontends is hard to implement for unusual patterns as it is more of an art than science. GenAI is very suitable to determine common accessibility issues and suggest solutions right in the development environment. Are you using right aria tags ? Will the changes be announces properly ? Is the tab indexing appropriate ? All these issues can be detected right in the development phase.

Cross device compatibility

GenAI can generate code that can work across different frotnends including email. It is also possible for the browsers and email clients to provide sufficient training data to assist such technologies in developing neccessary intelligence.

Better localization

We are already seeing trends where smaller companies are using GenAI to translate strings and to support more languages than what would have been possible for them otherwise.


GenAI technologies are especially good at refactoring code. Once you have your components designes, GenAI can analyze them and refactor them with better naming, structure and taking the common code into reusable components.

Test code generationg

Generating unit and integration tests is something that GenAI is really good at. Given a method it can tell you what all you need to test for and even generate the test code for you. This will improve maintainability of your codebase over time.


Generative AI technologies are becoming popular. They are far from replacing humans but they can give a huge productivity bost to human programmers and especially front end engineers.