hig.sePublications
Change search
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • harvard-cite-them-right
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • sv-SE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • de-DE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf
Alternativ för State Management: En jämförande analys av olika bibliotek iReact-applikationer: En studie av Redux och Zustand i en React-baserd applikation
University of Gävle, Faculty of Engineering and Sustainable Development, Department of Computer and Geospatial Sciences.
University of Gävle, Faculty of Engineering and Sustainable Development, Department of Computer and Geospatial Sciences.
2025 (Swedish)Independent thesis Basic level (degree of Bachelor), 10 credits / 15 HE creditsStudent thesis
Abstract [sv]

I takt med att moderna webbapplikationer blir allt mer interaktiva och datadrivna ökar kraven på effektiv hantering av tillstånd (state management) i front-end-utveckling. Denna studie fokuserar på att jämföra två vanliga bibliotek i React-ekosystemet: Redux och Zustand. Syftet är att undersöka hur dessa bibliotek påverkar applikationens prestanda och resursförbrukning under olika belastningsnivåer, med målet att ge utvecklare praktiskt underbyggda rekommendationer.

Studien genomfördes genom att bygga två identiska React-applikationer, en med Redux och en med Zustand där samtliga komponenter, uppdateringslogik och användarflöden var exakt lika. Prestanda-testerna utfördes under tre scenarier med 100, 200 och 500 samtidiga komponent uppdateringar, där mätvärden för CPU-användning, minnesförbrukning och render count samlades in med hjälp av Chrome DevTools.

Resultaten visar att Zustand konsekvent hade lägre CPU-användning än Redux, särskilt vid högre belastning (61,7 % jämfört med 98,2 % vid 500 uppdateringar). Även minnesförbrukningen var något lägre hos Zustand. Render count var jämn mellan biblioteken, vilket indikerar god selektiv rendering hos båda. Analysen pekar på att Zustands enklare arkitektur, utan actions och reducers, gör det mer resurseffektivt i miljöer med frekventa tillståndsförändringar.

Utöver detta belyser studien också begränsningarna hos Reacts inbyggda Context API. Även om det är lämpligt för enklare tillståndsdelning, visar tidigare forskning och denna studies resultat att det inte skalar väl i större applikationer, där externa bibliotek erbjuder bättre kontroll och prestandaoptimering.

Slutsatsen är att Zustand är ett starkt alternativ i mindre till medelstora projekt där snabb implementation, låg komplexitet och prestanda är centralt. Redux kan däremot fortfarande vara att föredra i stora team eller projekt som kräver strikt datakontroll och omfattande debug-verktyg. Studien betonar vikten av att välja state management-lösning utifrån applikationens storlek, förändringstakt och tekniska krav.

Abstract [en]

As modern web applications become increasingly interactive and data-driven, the demand for efficient state management in front-end development grows. This study compares two popular libraries within the React ecosystem: Redux and Zustand. The aim is to investigate how these libraries impact application performance and resource consumption under varying levels of load, with the goal of providing developers with practically applicable insights.

Two functionally identical React applications were built one using Redux and the other using Zustand where all components, update logic, and user flows were kept consistent. Performance tests were conducted under three scenarios involving 100, 200, and 500 simultaneous component updates. Measurements for CPU usage, memory consumption, and render count were collected using Chrome DevTools.

The results show that Zustand consistently had lower CPU usage than Redux, particularly under high load. Memory usage was also slightly lower with Zustand. Render count remained stable between both libraries, indicating efficient selective rendering. The analysis suggests that Zustand’s simpler architecture, without the need for actions and reducers, contributes to better performance in environments with frequent state changes.

The study also highlights the limitations of React’s built-in Context API. While suitable for simple applications, previous research and this study’s findings confirm that it does not scale well in larger applications where external libraries offer better control and performance optimization.

The conclusion is that Zustand is a strong alternative for small to medium-sized projects where fast implementation, low complexity, and high performance are priorities. Redux, however, remains preferable for larger teams or projects requiring strict control over data flow and advanced debugging tools. This study emphasizes the importance of selecting a state management solution based on application size, update frequency, and technical requirements.

Place, publisher, year, edition, pages
2025. , p. 46
Keywords [en]
State management, React, Redux, Zustand, performance, CPU usage, memory consumption, front-end development
Keywords [sv]
State management, React, Redux, Zustand, prestanda, CPU- användning, minnesförbrukning, front-end utveckling
National Category
Computer Sciences
Identifiers
URN: urn:nbn:se:hig:diva-47574OAI: oai:DiVA.org:hig-47574DiVA, id: diva2:1975031
Subject / course
Computer science
Educational program
Study Programme in Computer Science
Supervisors
Examiners
Available from: 2025-06-24 Created: 2025-06-23 Last updated: 2025-10-02Bibliographically approved

Open Access in DiVA

fulltext(1473 kB)42 downloads
File information
File name FULLTEXT01.pdfFile size 1473 kBChecksum SHA-512
d0e0bca0d22fe3c7b31fd4d49693e11a20abd3b91153bcae5d6dbc6fe84b9433f6ea9b5b789c61dd115c54ed05360e74d52d8b3bca7dbd35db153390ea23062e
Type fulltextMimetype application/pdf

By organisation
Department of Computer and Geospatial Sciences
Computer Sciences

Search outside of DiVA

GoogleGoogle Scholar
Total: 43 downloads
The number of downloads is the sum of all downloads of full texts. It may include eg previous versions that are now no longer available

urn-nbn

Altmetric score

urn-nbn
Total: 63 hits
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • harvard-cite-them-right
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • sv-SE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • de-DE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf