我在我的项目中使用 React-18.2.0 并收到以下错误
Uncaught Error: createRoot(...): Target container is not a DOM element.
Run Code Online (Sandbox Code Playgroud)
我已经尝试了大部分上传到互联网的可能解决方案,但不幸的是它没有帮助。
main.js 文件是:
Uncaught Error: createRoot(...): Target container is not a DOM element.
Run Code Online (Sandbox Code Playgroud)
在 html 中,我有这个:
import React from 'react';
import { createRoot } from 'react-dom/client';
// eslint-disable-next-line no-unused-vars
const User = (props) => {
const {control, getValues, setValue} = useForm({
defaultValues: props,
});
return (
<React.Fragment>
<UserSignin></UserSignin>
</React.Fragment>
);
};
const UserSignin = (props) => {
return (
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" …Run Code Online (Sandbox Code Playgroud)