Fast refresh for legacy React.createElement
in .js
files
#265
-
Hi ViteJS community, I've encountered a regression in the fast refresh behavior with legacy React's Environment:
Steps to Reproduce:
Example Code: // Test.js
import React from "react"
export function Test() {
const [counter, setCounter] = React.useState(0);
return React.createElement("button", {onClick: () => setCounter(counter + 1)}, `Counter: ${counter}`);
}
// App.js
import { Test } from './Test.js'
import React from "react"
export default function App() {
return React.createElement(Test, {});
} Workarounds:
I suspect the last option is the most appropriate workaround, but I want to confirm that this issue isn't indicative of a broader bug. Thank you for looking into this. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
4.0.2 was actually a fix, the condition was revered because the default 'jsxRutime' is 'automatic'. If you are using 'createElement', setting |
Beta Was this translation helpful? Give feedback.
4.0.2 was actually a fix, the condition was revered because the default 'jsxRutime' is 'automatic'. If you are using 'createElement', setting
jsxRuntime
toclassic
is the expected thing and not at all a workaround!