admin管理员组文章数量:1208155
I have a chakraUI project which is using chakra2, and I want to use MUI icons. I don't need MUI for anything except the icons
When I add an icon to the page I get the following errors:
I have reproduced this in a basic Vite project
import { Schedule } from '@mui/icons-material';
import { ChakraProvider } from '@chakra-ui/react';
function App() {
return (
<>
{/* Uncommenting the chakraProvider causes the error */}
{/* <ChakraProvider> */}
{/* If I have the chakra provider and not the icon it all works as expected */}
<Schedule />
<h1>Hello world</h1>
{/* </ChakraProvider> */}
</>
)
}
Package version:
"@chakra-ui/react": "^2.10.5",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
"@mui/icons-material": "^6.4.0",
"@mui/material": "^6.4.0",
I have no idea why these aren't working together, perhaps it has something to do with emotion, but I'm not sure how these are used internally in the two libraries or what I can do to resolve the issue.
chakra v1 and v3 don't seem to cause the issue however upgrading to v3 is a huge deal so I would really rather not do that.
本文标签: reactjsAdding MUI icon to ChakraUI projectStack Overflow
版权声明:本文标题:reactjs - Adding MUI icon to ChakraUI project - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738724442a2108947.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论