When was the last time you looked at your frontend and asked: Is this built for performance? For scale? For what’s next?
In the rush to deliver digital experiences, many engineering teams inherit performance debt, slow render times, bloated bundles, and runtime-heavy libraries chosen for speed of delivery, not sustainability. Styling layers get stacked. Component libraries get entrenched. And before long, every new feature feels like it’s working against the grain.
But in a world where Lighthouse scores impact SEO, milliseconds affect conversions, and users expect instant interactivity, “working” isn't enough. Your frontend must be engineered to perform and to evolve.
This guide is for teams ready to rethink their approach. For engineering leads building for scale, developers tired of sluggish UIs, and decision-makers committed to modern delivery standards.
What follows is a practical framework to:
- Diagnose and address performance bottlenecks
- Benchmark multiple UI stacks based on measurable outcomes
- Implement a phased migration using Panda-CSS and Formik, tools aligned with the future of frontend architecture
Whether you're modernizing legacy code or starting fresh, this playbook is your blueprint for delivering fast, scalable, and resilient digital experiences.
Problem Framing: When "Simple" Isn't Fast Enough
Even a basic login route on a cloud platform can become a performance bottleneck if the underlying frontend stack is not optimized. When high render times, large JavaScript bundles, and long tasks are present, the user experience suffers.
To build a performance-first frontend, you should:
- Set Lighthouse performance targets of 90 or above to reflect strong perceived speed and interactivity.
- Aim for FCP and LCP under 5 seconds even in degraded network scenarios (e.g., Slow 3G with CPU throttling).
- Identify and eliminate long tasks, which block the main thread and delay meaningful rendering.
- Isolate layout and styling concerns by removing extraneous UI dependencies before running any performance benchmarking.
These baseline actions help you clearly quantify what’s holding your current frontend back.
Designing the POC: A Metrics-First Mindset
A successful migration starts with data. Set up a controlled proof-of-concept (POC) environment to benchmark stack choices using:
- Webpack Bundle Analyzer to audit file sizes and identify disproportionately large dependencies.
- Lighthouse audits configured with real-world performance throttles (e.g., 6x CPU, Slow 3G).
- Chrome DevTools Performance tab to detect scripting-related long tasks and layout thrashing.
- Visual checkpoints and DOM snapshotting to ensure meaningful paint occurs quickly and predictably.
Use these measurements to compare options quantitatively rather than subjectively.
The Candidates: 7 UI Stacks In Competition
For example, for one of our B2C clients, we experimented with various combinations of UI frameworks and libraries to reduce load time, enable React Server Components (RSC), and streamline the frontend architecture. Here’s how the different implementations compared:
Stack |
Bundle Size |
Lighthouse |
FCP |
LCP |
Long Tasks |
antd-tailwind |
270 kB |
83 |
15.9s |
17.7s |
4 |
antd-styled |
268 kB |
86 |
14.5s |
18.2s |
5 |
antd-styled-formik |
246 kB |
87 |
15.8s |
19.6s |
5 |
antd-tailwind-formik |
160 kB |
89 |
12.2s |
15.5s |
2 |
mantine-formik |
117 kB |
94 |
7.5s |
7.5s |
2 |
arkui-formik |
117 kB |
98 |
4.6s |
4.6s |
1 |
panda-css + Formik |
115 kB |
99 |
4.9s |
4.9s |
0 |
Your choice should prioritize stacks that reduce runtime computation, eliminate redundant abstractions, and support long-term architectural alignment with frameworks like React Server Components.
Why Panda-CSS And Formik Work Well Together
The combination of Panda-CSS and Formik provides multiple advantages:
- Build-time CSS generation allows styles to be compiled at build time, eliminating the runtime cost of CSS-in-JS solutions and improving Time to Interactive.
- Formik’s composability enables flexible, accessible, and predictable form behavior without relying on opinionated UI abstractions that limit control.
- Decoupled architecture promotes modular design, reducing interdependencies and improving maintainability across teams and features.
- Alignment with modern React patterns like Server Components ensures your codebase is compatible with the direction of the ecosystem.
Together, they provide a lean, performant, and adaptable frontend foundation.
Handling Migration Challenges: Hybrid Stacks And Temporary Overhead
It’s common to encounter design system overlap during migration. To manage this:
- Adopt a hybrid approach by layering in new libraries (e.g., shadcn) without immediately removing all legacy components.
- Audit bundle impact regularly and track regressions or unintentional bloats from overlapping component libraries.
- Introduce guards around re-renders and implement memoization or controlled updates to avoid cascading state issues in legacy code.
- Document shared components that bridge between legacy and new systems to help reduce tech debt accumulation during transition.
This pragmatic hybrid approach ensures continuity while setting up for clean separation over time.
A Six-Phase Migration Strategy That Scales
Break your refactor into phases to reduce risk and ensure smooth delivery:
- Replace form components by implementing Formik for all forms and replacing styled-components with Panda-Css for consistent styling.
- Refactor layout primitives such as Flex, Grid, Box, and Typography to use atomic, Panda-Css-based design tokens.
- Migrate shared UI elements such as buttons, spinners, dropdowns, and tabs using minimal dependencies and custom implementations.
- Replace modal and drawer logic with accessible, lightweight counterparts compatible with build-time rendering.
- Revamp transient UI feedback elements such as toasts, alerts, and status banners with a unified approach to interactivity and design.
- Consolidate, clean, and document: finalize with dead-code removal, performance cleanup, and the introduction of React Server Components where applicable.
Each phase should conclude with regression testing and visual QA validation.
Optimization Outcomes: Metrics To Target
Track the following as your migration progresses:
- Render Count Reduction: Optimize components to render only when necessary, aiming for >90% drop from initial load counts.
- Rendering Triggers: Replace polling-based refresh cycles with event-driven updates for real-time but resource-efficient behavior.
- Lighthouse Score: Maintain a score of 95+ across key routes to signal consistency and quality.
- Paint Metrics: Ensure First Contentful Paint (FCP) and Largest Contentful Paint (LCP) consistently fall within sub-5 second targets even in stress test conditions.
Use visual regression tools alongside metric dashboards for early detection of UI or UX issues.
Long-Term Monitoring Strategy
Post-migration, keep performance top-of-mind with:
- Lighthouse regression testing integrated into your CI/CD workflow for every significant frontend PR.
- Webpack budget thresholds that break builds when bundle size exceeds defined limits.
- Custom render metrics implemented via browser APIs to track hydration timing, route load time, and CPU blocking on key user paths.
- Weekly audits and cross-team reviews to detect creeping performance debt and capture impact early.
Build performance monitoring into your team rituals, not as one-time checks, but as ongoing guardrails.
Engineering Insights To Guide Future Projects
- Runtime CSS-in-JS libraries can introduce hidden costs; prefer build-time styling where possible for long-term scalability.
- Phased, incremental migration provides superior stability and encourages learning across the team.
- Composable, unopinionated form libraries like Formik allow you to decouple UI from logic while keeping flexibility.
- Framework alignment should be a key driver: modern stacks need to anticipate RSC, SSR, hydration, and tree-shaking.
- Performance is cross-functional as engineering, QA, design, and product must all participate in its definition and success.
Looking Ahead
Frontend performance is no longer a competitive edge; it’s a baseline expectation. Today’s users demand speed, clarity, and seamless experiences. And tomorrow’s frontend architecture must be ready for server components, modular styling, and cross-device adaptability.
Refactoring with tools like Panda-CSS and Formik isn’t just a performance upgrade; it’s an opportunity to align your frontend with modern standards and futureproof your delivery pipeline.
If your current stack feels like it’s holding you back, this framework offers a grounded, testable, and team-friendly path forward. Use it to:
- Expose and eliminate inefficiencies
- Deliver fast, responsive interfaces
- Build for what’s next in React, whether that’s RSC, SSR, or edge-first rendering
Your frontend is your brand’s handshake with the user. Make sure it’s fast, intentional, and built to last. Interested in discussing more? Let's talk.

Bassam Ismail, Director of Digital Engineering
Away from work, he likes cooking with his wife, reading comic strips, or playing around with programming languages for fun.

S. M. Tashrik Anam, Senior Software Engineer
Tashrik enjoys working on front-end development, particularly in enhancing performance and code quality in frameworks like Next.js and React. He is passionate about learning new technologies and sharing insights through mentoring and writing. Outside of coding, he finds balance through coffee breaks and refreshing walks.
Leave us a comment