---
title: "Discussion on \"Stop Using a mounted Flag to Fix Theme Flash: Use useSyncExternalStore Instead\" | Hashnode"
description: "Discussion on \"Stop Using a mounted Flag to Fix Theme Flash: Use useSyncExternalStore Instead\". Next.js theme toggle crashed in production under Trusted Types. Why mounted-flag fix doesn't fix hydration mismatches, & how useSyncExternalStore does"
url: "https://hashnode.com/posts/stop-using-a-mounted-flag-to-fix-theme-flash-use-usesyncexternalstore-instead/6aa3054f8966ba4ed2c6f900"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Stop Using a mounted Flag to Fix Theme Flash: Use useSyncExternalStore Instead](https://uduakukpong.hashnode.dev/stop-using-a-mounted-flag-to-fix-theme-flash-use-usesyncexternalstore-instead?utm_source=hashnode&utm_medium=feed)

Next.js theme toggle crashed in production under Trusted Types. Why mounted-flag fix doesn't fix hydration mismatches, & how useSyncExternalStore does

Sep 10 · 11 min read · uduakukpong.hashnode.dev  
Read the article

-   [#typescript](https://hashnode.com/tag/typescript)
-   [#nextjs](https://hashnode.com/tag/nextjs)
-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#frontend-development](https://hashnode.com/tag/frontend-development)
-   [#software-development](https://hashnode.com/tag/software-development)
-   [#web-development](https://hashnode.com/tag/web-development)

## Written by

[Uduak Ukpong](https://hashnode.com/@flhlxix)

@flhlxix · Lagos, Nigeria

  
[View profile](https://hashnode.com/@flhlxix)

Writing up on the engineering problems I actually hit in production.

I'm a full-stack Developer working across React, Next.js, NestJS, and PostgreSQL.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
