Trending: Crack FAANG with our new JavaScript Interview Mastery!Try Now
Back to Curriculum
AI Prompt EngineeringModuleLesson 01

Refactoring & Code Quality

20m
Beginner
+50 XP
0% Done

Cleaning the Mess

Over time, codebases become messy. Functions get too long, variable names become confusing, and logic gets tangled. AI is the ultimate refactoring tool. It can instantly rewrite your code to adhere to best practices without changing what the code actually does.

The Refactor Prompt

Goal: Refactor this legacy React component.

Tasks:
1. Convert it from a Class Component to a Functional Component using Hooks.
2. Extract the inline CSS into a Tailwind class string.
3. Rename variables to be more descriptive.
4. Ensure there is no change to the UI or functionality.