The Trendyol Affiliate Ads team migrated from React Context API to Zustand after hitting performance ceilings caused by cascading re-renders and lack of granular subscriptions. Their complex Ads Editor was generating 8,000+ function calls per interaction, causing visible UI lag. They adopted a feature-based store architecture with 7 independent Zustand stores for the create flow, using Immer for nested state updates and named DevTools instances for debuggability. The incremental, feature-by-feature migration avoided production risk. Results included a ~20% average reduction in interaction latency (31% in the most complex scenario), 80%+ reduction in Cumulative Layout Shift, 28% fewer UpdateLayoutTree recalculations, and a 60% drop in developer onboarding time. Key lessons: granular selectors are the primary performance driver, scoped stores beat a single global store, and the real bottleneck was React doing unnecessary work rather than slow JavaScript execution.
Table of contents
What is the Affiliate Ads Editor?The Ads Creation FlowChallenges with Our Previous State ManagementThe New Architecture: Feature-Based StoresGet Okan Davut’s stories in your inbox1 Comment
Sort: