Skip to content
October 1, 2026
  • Bluesky
  • Facebook
  • Linkedin
  • Mastodon
  • RSS
  • Twitter
  • Youtube

Daily CyberSecurity

Zero-hour alerts. Unmatched analysis.

Primary Menu
  • Home
  • CVE Data
    • CVE Watchtower
    • Top Exploited CVEs
    • CVE Stats by Vendor
    • Q2 2026 Report
    • CVE Alerts
    • CVE Alert Settings
    • Pricing
  • Cyber Criminals
  • Data Leak
  • Free Tools
    • CVSS 3.1 Calculator
    • Certificate Viewer
    • DNS Lookup
    • Encoder & Hash Generator
    • IP / Subnet Calculator
    • Whois Lookup
  • Linux
  • Malware
  • Vulnerability
  • Submit Press Release
  • Weekly Recap
Light/Dark Button
  • Home
  • Technique
  • State Management Architecture. Part 2. From RTK Query to Zustand
  • Technique

State Management Architecture. Part 2. From RTK Query to Zustand

Dan Agbo January 19, 2025 7 minutes read
CVE-2024-31070 & CVE-2024-36491

This article is the second part of a series of publications by Hiveon’s leading frontend engineer Anton An about the best frameworks for state-management. You can read about the evolution of state-management, traditional Redux and RTK Toolkit, which develops its approaches, in the first part of the article.

In state-management, traditional Redux is considered obsolete. Modern alternatives include RTK Query and Zustand, and frameworks can be used together to complement each other in your project.

RTK Query

RTK Query focuses on synchronizing application state with server data, making it an excellent tool for API-driven projects. It provides automatic caching to minimize redundant requests, request deduplication, and built-in polling intervals for periodic data updates—features that streamline server state management.

However, effective cache management is critical. Incorrectly configured cache invalidation or tag relationships can result in stale data or unnecessary re-fetching, impacting performance. For instance, subtle changes in input parameters might trigger excessive re-renders if tags are not carefully defined. Thorough planning and testing are required to leverage RTK Query’s full potential.


// missionApi.js (API Slice)
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';

// Define the mission API slice
export const missionApi = createApi({
reducerPath: 'missionApi',
baseQuery: fetchBaseQuery({ baseUrl: 'https://api.space-mission.example.com/' }), // Hypothetical API
tagTypes: ['Missions', 'Resources'], // Tags for cache invalidation
endpoints: (builder) => ({
// Fetch all active missions
getMissions: builder.query({
query: () => 'missions',
providesTags: ['Missions'], // Tag for caching missions
}),
// Fetch resource levels (oxygen, fuel)
getResources: builder.query({
query: () => 'resources',
providesTags: ['Resources'], // Tag for caching resources
// Polling every 30 seconds to simulate real-time updates
pollingInterval: 30000,
}),
// Update mission status (e.g., mark as completed)
updateMissionStatus: builder.mutation({
query: ({ id, status }) => ({
url: `missions/${id}`,
method: 'PATCH',
body: { status },
}),
invalidatesTags: ['Missions'], // Invalidate mission cache on update
}),
}),
});

// Export hooks for usage in components
export const {
useGetMissionsQuery,
useGetResourcesQuery,
useUpdateMissionStatusMutation,
} = missionApi;

// store.js (Store Configuration)
import { configureStore } from '@reduxjs/toolkit';
import { missionApi } from './missionApi';

// Configure the store with RTK Query reducer
const store = configureStore({
reducer: {
[missionApi.reducerPath]: missionApi.reducer,
},
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware().concat(missionApi.middleware),
});

export default store;

// MissionDashboard.js (Component)
import React from 'react';
import {
useGetMissionsQuery,
useGetResourcesQuery,
useUpdateMissionStatusMutation,
} from './missionApi';

export function MissionDashboard() {
// Fetch missions with automatic caching
const {
data: missions,
error: missionsError,
isLoading: missionsLoading,
} = useGetMissionsQuery();

// Fetch resources with polling
const {
data: resources,
error: resourcesError,
isLoading: resourcesLoading,
} = useGetResourcesQuery();

// Mutation to update mission status
const [updateMissionStatus] = useUpdateMissionStatusMutation();

if (missionsLoading || resourcesLoading) return <p>Loading mission data...</p>;
if (missionsError || resourcesError)
return <p>Error fetching data: {missionsError?.message || resourcesError?.message}</p>;

return (
<div>
<h1>Space Mission Control Dashboard</h1>

{/* Missions Section */}
<section>
<h2>Active Missions</h2>
<ul>
{missions.map((mission) => (
<li key={mission.id}>
{mission.destination} - {mission.status}
{mission.status === 'Active' && (
<button
onClick={() =>
updateMissionStatus({ id: mission.id, status: 'Completed' })
}
>
Mark as Completed
</button>
)}
</li>
))}
</ul>
</section>

{/* Resources Section */}
<section>
<h2>Resource Levels (Updated every 30s)</h2>
<p>Oxygen: {resources.oxygen}%</p>
<p>Fuel: {resources.fuel}%</p>
</section>
</div>
);
}

// App.js (Main App)
import React from 'react';
import { Provider } from 'react-redux';
import store from './store';
import { MissionDashboard } from './MissionDashboard';

function App() {
return (
<Provider store={store}>
<MissionDashboard />
</Provider>
);
}

export default App;
  • missionApi: Defines endpoints for fetching missions (getMissions), resources (getResources), and updating mission status (updateMissionStatus).
  • Caching: providesTags ensures data is cached under ‘Missions’ and ‘Resources’. The updateMissionStatus mutation invalidates the ‘Missions’ tag, triggering a refetch.
  • Polling: getResources uses a 30-second pollingInterval to simulate real-time resource monitoring.

This tool is best suited for applications where server data is a primary concern, as it excels at managing the client-side cache of that data, handling the fetching, synchronization, and updates automatically. For purely local state needs, Redux Toolkit alone may suffice.

RTK Query Overview:

  • Primary Role: Managing server state in data-intensive applications.
  • Advantages: Efficient caching, deduplication, and polling support.
  • Potential Issues: Cache configuration demands precision to avoid inconsistencies.

Next, we turn to Zustand, a contrasting approach that prioritizes simplicity over structure.

Zustand

Zustand offers a lightweight alternative to the Redux ecosystem, appealing to developers who need global state management without extensive overhead. Its minimal API enables rapid state setup—ideal for small libraries or performance-sensitive components where a full Redux implementation would be excessive.

This simplicity comes with trade-offs. Zustand lacks the rigid structure of Redux, requiring disciplined practices to maintain consistency in larger applications. Additionally, it offers no native support for complex asynchronous workflows, leaving developers to implement custom solutions as needed.

For projects prioritizing speed and minimalism, Zustand is highly effective. Its flexibility makes it a compelling choice when the complexity of Redux outweighs its benefits.

When it comes to syntax, Zustand is impressively more laconic than the same RTK library when writing code that handles passing states to components. Here’s an example of Zustand code implementing the astronaut status management similar to our Traditional Redux example:

// missionStore.js (Zustand Store)
import { create } from 'zustand';

// Create a Zustand store for mission data
const useMissionStore = create((set) => ({
astronauts: [
{ id: 1, name: 'Alex Carter', status: 'In Space' },
{ id: 2, name: 'Sam Rivera', status: 'On Ground' },
],
toggleAstronautStatus: (id) =>
set((state) => ({
astronauts: state.astronauts.map((astronaut) =>
astronaut.id === id
? {
...astronaut,
status: astronaut.status === 'In Space' ? 'On Ground' : 'In Space',
}
: astronaut
),
})),
}));

export default useMissionStore;

// MissionControl.js (Component with Zustand)
import React from 'react';
import useMissionStore from './missionStore';

export function MissionControl() {
// Access state and actions directly from the store
const astronauts = useMissionStore((state) => state.astronauts);
const toggleAstronautStatus = useMissionStore((state) => state.toggleAstronautStatus);

return (
<div>
<h1>Space Mission Control (Zustand)</h1>
<h2>Astronaut Status</h2>
<ul>
{astronauts.map((astronaut) => (
<li key={astronaut.id}>
{astronaut.name} - {astronaut.status}
<button onClick={() => toggleAstronautStatus(astronaut.id)}>
Toggle Status
</button>
</li>
))}
</ul>
</div>
);
}

// App.js (Main App with Zustand)
import React from 'react';
import { MissionControl } from './MissionControl';

function App() {
return <MissionControl />;
}

export default App;
  • Setup: A single file (missionStore.js) with create defines the store. No reducers or middleware needed.
  • Usage: The useMissionStore hook provides direct access to state (astronauts) and actions (toggleAstronautStatus) without extra boilerplate.
  • Theme: Manages astronaut statuses (e.g., “In Space” or “On Ground”), fitting the mission control theme.
  • Pros: Lightweight, minimal API, no provider wrapper required.
  • Trade-offs: No built-in structure for complex async flows (e.g., API calls would need custom logic).

As you can see Zustand is ideal for simple state needs in our space mission context. However, as noted, its lack of rigid structure means developers must enforce discipline in larger apps, and async tasks (e.g., fetching astronaut data) would need manual handling—unlike RTK’s ecosystem support.

 

Zustand Essentials:

  • Best Scenarios: Simple global state or performance-critical components.
  • Benefits: Lightweight design and efficient updates.
  • Limitations: Requires careful management in large projects; async support is minimal: asynchronous logic is often handled by placing async functions directly within the store or by using Zustand’s middleware support if needed.

To clarify these distinctions, let’s compare the options directly.

Comparative Analysis

The table below consolidates key attributes—performance, scalability, learning curve, ecosystem support, and challenges—based on practical observations. It aims to assist in identifying the most suitable tool for your project.

Feature Traditional Redux Redux Toolkit RTK Query Zustand
Performance Solid when optimized, but requires manual effort. Enhanced by streamlined processes and less boilerplate. Strong for server state with proper caching. Highly efficient for localized updates.
Scalability Effective for large apps, though setup is cumbersome. Scales well with a structured yet efficient approach. Excellent for API-heavy projects. Suitable for smaller to mid-sized apps with discipline.
Learning Curve High due to extensive configuration requirements. Moderate; builds on Redux with simplified patterns. Moderate, with added complexity from caching. Low, thanks to its straightforward API.
Ecosystem Extensive and mature, with broad middleware support. Robust, leveraging Redux’s ecosystem with modern tools. Well-integrated within Redux frameworks. Smaller but expanding steadily.
Challenges Verbose code; unoptimized selectors hurt performance. Abstraction may obscure mechanics. Cache mismanagement can disrupt data flow. Lack of structure risks inconsistency.
Ideal Use Complex apps needing precise control. Modern, structured state management. Server-data synchronization. Lightweight, performance-focused needs.

Building on this comparison, consider how these tools might work together.

Combining Approaches

In some cases, a hybrid strategy can maximize the strengths of multiple tools. Pairing Redux Toolkit with RTK Query, for instance, provides robust UI state management alongside optimized server data handling within the Redux ecosystem. Adding Zustand for specific, performance-critical components introduces localized efficiency without redundant complexity.

Integration poses challenges, however. While Redux Toolkit and RTK Query align seamlessly, Zustand’s distinct paradigm requires careful consideration for synchronization. While React’s useSyncExternalStore primitive provides a foundation for integrating external stores, connecting disparate state managers like Redux and Zustand smoothly often relies on well-designed application architecture or potentially specific adapter libraries. Without deliberate design, this can lead to inefficiencies, such as redundant updates. Clear boundaries and testing are essential to ensure a cohesive architecture.

Finally, let’s distill this into a practical framework for decision-making.

Checklist: How to choose the right framework for your project situation?

The following considerations can guide your choice of state management solution, tailored to your project’s needs:

  • How big is your project going to be? Large, intricate applications often benefit from the structure provided by the Redux ecosystem (typically via Redux Toolkit); smaller efforts might lean toward Zustand.
  • What states will need to be managed? Focus on UI state suggests RTK or Zustand; server synchronization points to RTK Query.
  • What kind of performance are you willing to put up with? Evaluate memoization and caching needs; Zustand excels in lightweight contexts.
  • What is the expertise of the development team? Familiarity with Redux supports RTK adoption; simpler tools suit less experienced teams.
  • What integrations are you planning to do? Combining tools requires strategic state synchronization to avoid overhead.

These questions provide a starting point for aligning your choice with project demands and team capabilities.

Conclusion

Choosing a state management solution requires balancing complexity, performance, and practicality. Traditional Redux offers unmatched control for intricate applications, though its verbosity can be a hurdle. Redux Toolkit refines this approach, delivering efficiency and clarity for modern needs. RTK Query excels in server-state scenarios, provided cache management is precise. Zustand, meanwhile, provides a nimble alternative for simpler or performance-driven requirements.

A combined approach can leverage these strengths, but demands thoughtful integration. By assessing your project’s scope, state needs, and team expertise—guided by the framework above—you can select a strategy that ensures scalability and maintainability tailored to your goals.

SHARE
Share on FacebookShare on XShare on LinkedInShare on TelegramShare on BlueskyShare on Mastodon

Search

Translation

CVE ALERTS
📈

EPSS Spike Alerts
Catch risk spikes before they make headlines.

🎯

Custom EPSS/CVSS
Set score thresholds to effectively filter noise.

🛡️

Exploit Intel
Real-world exploit signals beyond the KEV catalog.

🐙

GitHub Issues
Auto-create alert tickets without duplication.

📬

Weekly Digest
Clean summaries, eliminating email spam.

🏷️

Watchlist Groups
Tag vulnerabilities by team (Infra/AppSec/SOC).

🔀

Smart Routing
Route chat channels based on severity levels.

🚨

RBP Tracker
Early warning detection and tracking system.

Subscribe – $7/mo or try free for 14 days →

🚨 Active Exploits in the Wild

  • CVE-2026-100382CVSS 10.0
    Improper Neutralization of Special Elements used in an OS Command (\'OS Command Injection\') vulnerability in Wikimedia Foundation Mediawiki...
    Admin intel📅 Updated: Oct 1, 2026
  • CVE-2026-76504CVSS 9.8
    A vulnerability in the API session-based authentication management of Cisco Catalyst SD-WAN Manager could allow an unauthenticated, remote...
    Admin intelCISA KEV📅 Added to KEV: Sep 30, 2026📅 Updated: Sep 30, 2026
  • CVE-2026-86950CVSS 8.8
    An out-of-bounds write issue was addressed with improved bounds checking. This issue is fixed in iOS 26.7.1 and...
    Admin intelCISA KEV📅 Added to KEV: Sep 29, 2026📅 Updated: Sep 29, 2026
  • CVE-2026-88772
    Memory overflow vulnerability leading to remote code execution or denial of service.
    Admin intelCISA KEV📅 Added to KEV: Sep 27, 2026📅 Updated: Sep 27, 2026
  • CVE-2026-88771
    Remote code execution due to improper input validation that can allow an unauthenticated attacker to execute arbitrary commands.
    Admin intelCISA KEV📅 Added to KEV: Sep 27, 2026📅 Updated: Sep 27, 2026
  • CVE-2026-65660CVSS 8.8
    Improper control of generation of code (\'code injection\') in Microsoft Office SharePoint allows an authorized attacker to execute...
    Admin intelCISA KEV📅 Added to KEV: Sep 25, 2026📅 Updated: Sep 25, 2026
  • CVE-2026-5430CVSS 10.0
    The JWT authentication mechanism accepts tokens signed with algorithms other than those explicitly configured or supported. This allows...
    CISA KEV📅 Added to KEV: Sep 24, 2026
  • CVE-2026-71362CVSS 9.1
    Adobe Commerce is affected by an Incorrect Authorization vulnerability that could result in privilege escalation. An attacker could...
    CISA KEV📅 Added to KEV: Sep 24, 2026
Powered by CVE Watchtower

Critical Vulnerabilities

  • CVE-2026-75957CVSS 9.8
    The Ultimate Multisite – WordPress Multisite SaaS & WaaS Platform plugin for WordPress is vulnerable to Authentication Bypass...
    📅 Updated: Oct 1, 2026
  • CVE-2026-15989CVSS 9.8
    The Super Forms – Drag & Drop Form Builder plugin for WordPress is vulnerable to Privilege Escalation in...
    📅 Updated: Oct 1, 2026
  • CVE-2025-41753CVSS 9.3
    The object name of a dynamically created BACnet File Object is interpreted as a file path without sufficient...
    📅 Updated: Oct 1, 2026
  • CVE-2026-92966CVSS 9.1
    The The Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress plugin for WordPress is vulnerable...
    📅 Updated: Oct 1, 2026
  • CVE-2026-82824CVSS 9.3
    Hitachi Coding Software Suite contains a vulnerability related to Path Traversal vulnerability that allows an attacker to access,...
    📅 Updated: Oct 1, 2026
  • CVE-2026-82825CVSS 9.3
    Hitachi Coding Software Suite contains a vulnerability related to Missing Authentication for Critical Function. This allows an unauthenticated...
    📅 Updated: Oct 1, 2026
  • CVE-2026-82827CVSS 9.3
    Hitachi Coding Software Suite contains a vulnerability related to Use of Hard-coded Cryptographic Key. The Hardcoding of JWT...
    📅 Updated: Oct 1, 2026
  • CVE-2026-82829CVSS 9.3
    Hitachi Coding Software Suite contains a vulnerability related to Hidden Functionality vulnerability which allows an attacker to gain...
    📅 Updated: Oct 1, 2026
Powered by CVE Watchtower

Daily CyberSecurity

  • About SecurityOnline.info
  • Advertise with us
  • Announcement
  • Contact
  • Contributor Register
  • Login
  • Disclaimer
  • DCMA
  • Privacy Policy
  • About SecurityOnline.info
  • Advertise on SecurityOnline.info
  • Contact Us

When you purchase through links on our site, we may earn an affiliate commission. Here’s how it works

  • CVE Watchtower
  • CVE Statistics by Vendor 2026
  • Q2 2026 Report
  • Top Exploited CVEs
  • Bluesky
  • Facebook
  • Linkedin
  • Mastodon
  • RSS
  • Twitter
  • Youtube
© 2017 - 2026 Daily CyberSecurity. All Rights Reserved.