diff --git a/package.json b/package.json index 791bfc81..b13bce77 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,8 @@ "build": "tsup && cp src/style.css dist/ReactToastify.css" }, "peerDependencies": { - "react": "^18 || ^19", - "react-dom": "^18 || ^19" + "react": "^17 || ^18 || ^19", + "react-dom": "^17 || ^18 || ^19" }, "prettier": { "printWidth": 120, @@ -70,7 +70,8 @@ "vite-plugin-istanbul": "^6.0.2" }, "dependencies": { - "clsx": "^2.1.1" + "clsx": "^2.1.1", + "use-sync-external-store": "^1.4.0" }, "main": "dist/index.js", "typings": "dist/index.d.ts", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 45707e39..53900129 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: clsx: specifier: ^2.1.1 version: 2.1.1 + use-sync-external-store: + specifier: ^1.4.0 + version: 1.4.0(react@19.0.0) devDependencies: '@4tw/cypress-drag-drop': specifier: ^2.2.5 @@ -2862,6 +2865,11 @@ packages: uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + use-sync-external-store@1.4.0: + resolution: {integrity: sha512-9WXSPC5fMv61vaupRkCKCxsPxBocVnwakBEkMIHHpkTTg6icbJtg6jzgtLDm4bl3cSHAca52rYWih0k4K3PfHw==} + peerDependencies: + react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 + uuid@3.4.0: resolution: {integrity: sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==} deprecated: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. @@ -5961,6 +5969,10 @@ snapshots: dependencies: punycode: 2.3.1 + use-sync-external-store@1.4.0(react@19.0.0): + dependencies: + react: 19.0.0 + uuid@3.4.0: {} uuid@8.3.2: {} diff --git a/src/hooks/useToastContainer.ts b/src/hooks/useToastContainer.ts index 184b4921..e8ad0fbe 100644 --- a/src/hooks/useToastContainer.ts +++ b/src/hooks/useToastContainer.ts @@ -1,4 +1,5 @@ -import { useRef, useSyncExternalStore } from 'react'; +import { useRef } from 'react'; +import { useSyncExternalStore } from 'use-sync-external-store/shim'; import { isToastActive, registerContainer } from '../core/store'; import { Toast, ToastContainerProps, ToastPosition } from '../types';