---
title: "Comment by Mm Cc on \"Building Your Own React State Management: A Deep Dive into Custom Stores\" | Hashnode"
description: "Great deep dive! One best practice I'd add is to always wrap your core state logic in a useRef alongside useSyncExternalStore for concurrent-mode safety—it prev"
url: "https://hashnode.com/posts/building-your-own-react-state-management-a-deep-dive-into-custom-stores/67d5695e0e62b5c8b6baf75a/comment/69f89c6823209af730ee0311"
---

[Discussion](https://hashnode.com/posts/building-your-own-react-state-management-a-deep-dive-into-custom-stores/67d5695e0e62b5c8b6baf75a)

Comment [Building Your Own React State Management: A Deep Dive into Custom Stores](https://hashnode.com/posts/building-your-own-react-state-management-a-deep-dive-into-custom-stores/67d5695e0e62b5c8b6baf75a)

[Mm Cc](https://hashnode.com/@mmcc)

[May 4](https://hashnode.com/posts/building-your-own-react-state-management-a-deep-dive-into-custom-stores/67d5695e0e62b5c8b6baf75a/comment/69f89c6823209af730ee0311)

Great deep dive! One best practice I'd add is to always wrap your core state logic in a `useRef` alongside `useSyncExternalStore` for concurrent-mode safety—it prevents stale closures and unnecessary re-renders when subscriptions fire in rapid succession.
