<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/zustand-and-react-context-xbemydh7t" -->

---
title: Zustand and React Context | daily.dev
description: Zustand is a simple and fast library for global client-state management. However, using global stores in Zustand can have drawbacks, such as difficulty...
canonical: https://daily.dev/posts/zustand-and-react-context-xbemydh7t
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Zustand and React Context | daily.dev
og:description: Zustand is a simple and fast library for global client-state management. However, using global stores in Zustand can have drawbacks, such as difficulty...
og:url: https://daily.dev/posts/zustand-and-react-context-xbemydh7t
og:image: https://api.daily.dev/og/posts/XbEMYdH7T.png
og:image:alt: Zustand and React Context
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Zustand and React Context

**[TkDodo](https://daily.dev/sources/tkdodo)** · [@tkdodo](https://daily.dev/tkdodo) · 6 min read · 100 upvotes · 4 comments

## Summary

Zustand is a simple and fast library for global client-state management. However, using global stores in Zustand can have drawbacks, such as difficulty initializing the store with props, complex testing, and lack of reusability. To solve these issues, React Context can be used to share the store instance while keeping the store values isolated. By combining Zustand with React Context, it becomes easier to initialize the store with props, simplify testing, and achieve component encapsulation and reusability.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://tkdodo.eu/blog/zustand-and-react-context>

## Community discussion

Top comments from developers on daily.dev.

**@banghuynh04** · 2 upvotes

> Currently using Zustand for my project, It's so simple, Good job!

**@robertoumbelino** · 2 upvotes

> @tkdodo Nice article. I didn't know you could use createStore and create inside a component. I really like it.

**@chen404** · 1 upvotes

> Awsome

**@srivishnusivan** · 0 upvotes

> I'm planning to migrate from redux toolkit to zustand, is it advisable??

---

Tags: [#react](https://daily.dev/tags/react), [#zustand](https://daily.dev/tags/zustand)

[View this post on daily.dev](https://daily.dev/posts/zustand-and-react-context-xbemydh7t)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Zustand and React Context","url":"https://daily.dev/posts/zustand-and-react-context-xbemydh7t","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/zustand-and-react-context-xbemydh7t"},"datePublished":"2024-04-14T14:59:44.733Z","dateModified":"2026-03-15T03:33:44.936Z","description":"Zustand is a simple and fast library for global client-state management. However, using global stores in Zustand can have drawbacks, such as difficulty...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/c7b3a5ceec00f2e4a455faf78a54d8d8?_a=AQAEufR","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/c7b3a5ceec00f2e4a455faf78a54d8d8?_a=AQAEufR","isAccessibleForFree":true,"articleSection":"TkDodo","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Person","name":"Dominik D","url":"https://daily.dev/tkdodo","image":"https://avatars.githubusercontent.com/u/1021430?v=4","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":2360}},"commentCount":4,"discussionUrl":"https://daily.dev/posts/zustand-and-react-context-xbemydh7t","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":100},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":4}],"keywords":"react,zustand","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"TkDodo","item":"https://daily.dev/sources/tkdodo"},{"@type":"ListItem","position":3,"name":"Zustand and React Context"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/zustand-and-react-context-xbemydh7t","comment":[{"@type":"Comment","text":"Currently using Zustand for my project, It’s so simple, Good job!","datePublished":"2024-04-19T07:27:50.744Z","url":"https://daily.dev/posts/XbEMYdH7T#c-PdN2WNJyh","author":{"@type":"Person","name":"Bằng Huỳnh","url":"https://daily.dev/banghuynh04","image":"https://lh3.googleusercontent.com/a-/AFdZucrP-32YkoqlA0mn62absfTxSC7O5gF-dvT5Ljcg=s100"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2}},{"@type":"Comment","text":"@tkdodo Nice article. I didn’t know you could use createStore and create inside a component. I really like it.","datePublished":"2024-05-28T14:14:30.528Z","url":"https://daily.dev/posts/XbEMYdH7T#c-vnbTnLnV8","author":{"@type":"Person","name":"Roberto Umbelino","url":"https://daily.dev/robertoumbelino","image":"https://avatars.githubusercontent.com/u/17939056?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2}},{"@type":"Comment","text":"Awsome","datePublished":"2024-04-24T08:27:45.776Z","url":"https://daily.dev/posts/XbEMYdH7T#c-NQ77pBZzp","author":{"@type":"Person","name":"Chen","url":"https://daily.dev/chen404","image":"https://avatars.githubusercontent.com/u/58675561?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}},{"@type":"Comment","text":"I’m planning to migrate from redux toolkit to zustand, is it advisable??","datePublished":"2024-11-17T10:36:59.898Z","url":"https://daily.dev/posts/XbEMYdH7T#c-skrjhZUjB","author":{"@type":"Person","name":"srivishnu sivan","url":"https://daily.dev/srivishnusivan","image":"https://lh3.googleusercontent.com/a/ACg8ocJabyOGCNqnyb9rS2VnvAiXf9SoWvkeGRoopH3i6j87hBY2Afo=s96-c"}}]}
```

