@@ -86,6 +86,18 @@ def _determine_nextjs_version() -> str:
8686 return default_version
8787
8888
89+ def _determine_react_version () -> str :
90+ default_version = "19.1.0"
91+ if (version := os .getenv ("REACT_VERSION" )) and version != default_version :
92+ from reflex .utils import console
93+
94+ console .warn (
95+ f"You have requested react@{ version } but the supported version is { default_version } , abandon all hope ye who enter here."
96+ )
97+ return version
98+ return default_version
99+
100+
89101class PackageJson (SimpleNamespace ):
90102 """Constants used to build the package.json file."""
91103
@@ -99,15 +111,17 @@ class Commands(SimpleNamespace):
99111
100112 PATH = "package.json"
101113
114+ _react_version = _determine_react_version ()
115+
102116 DEPENDENCIES = {
103117 "@emotion/react" : "11.14.0" ,
104118 "axios" : "1.9.0" ,
105119 "json5" : "2.2.3" ,
106120 "next" : _determine_nextjs_version (),
107121 "next-sitemap" : "4.2.3" ,
108122 "next-themes" : "0.4.6" ,
109- "react" : "19.1.0" ,
110- "react-dom" : "19.1.0" ,
123+ "react" : _react_version ,
124+ "react-dom" : _react_version ,
111125 "react-focus-lock" : "2.13.6" ,
112126 "socket.io-client" : "4.8.1" ,
113127 "universal-cookie" : "7.2.2" ,
@@ -119,5 +133,5 @@ class Commands(SimpleNamespace):
119133 }
120134 OVERRIDES = {
121135 # This should always match the `react` version in DEPENDENCIES for recharts compatibility.
122- "react-is" : "19.1.0"
136+ "react-is" : _react_version
123137 }
0 commit comments