[英]Why react mui pagination component causes Failed to execute 'createElement' on 'Document': The tag name provided ('/.js') is not a valid name. error?
I am using mui for my react project.我正在为我的 React 项目使用 mui。 When i am using button component of mui it is working but pagination component creates this error:
当我使用 mui 的按钮组件时,它正在工作,但分页组件会产生此错误:
DOMException: Failed to execute 'createElement' on 'Document': The tag name provided ('/7f3bb9f17db538730cfa2032641aa64e.js') is not a valid name. DOMException:无法在“文档”上执行“createElement”:提供的标签名称(“/7f3bb9f17db538730cfa2032641aa64e.js”)不是有效名称。
In another project which is created with create-react-app is working but this is not working.在另一个使用 create-react-app 创建的项目中正在运行,但这不起作用。
I tried lots of things like reinstall node_modules, searched for any clue about mui in webpack but could not solve the problem.我尝试了很多事情,比如重新安装 node_modules,在 webpack 中搜索有关 mui 的任何线索,但无法解决问题。
import React from 'react'
import Pagination from '@mui/material/Pagination';
import './index.css'
const Table = () => {
return (
<div className='table'>
<Pagination count={10} variant="outlined" color="primary" />
</div>
)
}
export default Table
I was using file-loader for svg,img.. in webpack but it should be url-loader我正在为 svg 使用文件加载器,img .. 在 webpack 但它应该是 url-loader
before:前:
{
test: /\.png|svg|jpg|gif$/,
use: ["file-loader"],
},
after:后:
{
test: /\.(jpe?g|gif|png|svg)$/i,
use: [
{
loader: 'url-loader',
options: {
limit: 10000
}
}
]
},
note: do not forget to install url-loader..注意:不要忘记安装 url-loader..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.