简体   繁体   English

为什么在使用 Material UI 时会出现此错误?

[英]Why am I getting this error when using Material UI?

I used npm install @mui/material and npm install @mui/icons-material right after to import a search icon.我使用npm install @mui/materialnpm install @mui/icons-material导入搜索图标。 my code looks like this我的代码看起来像这样

import {Search} from "@mui/icons-material";

However, when I write it in my code as <Search /> I get this error.但是,当我在代码中将其编写为<Search />时,我会收到此错误。

在此处输入图像描述

What is the issue?问题是什么?

The package you are trying to use is a set of react components.您尝试使用的 package 是一组反应组件。 In other words, you can't use it without React.换句话说,没有 React 就无法使用它。 Have a look at this .看看这个

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 cmd 中安装材料 ui 以进行反应时出现错误。我正在使用此命令 npm i @material-ui/icons 并出现以下错误:: - I am getting error while installing material ui in cmd for react .I am using this command npm i @material-ui/icons and getting following errors :: 为什么使用 axios 调用 api 时出现错误? - Why I am getting error when calling the api using axios? 为什么在 Javascript 中使用“类”时会出现语法错误 - Why am I getting a Syntax error when using “class” in Javascript 为什么在使用 split function of javascript 时出现错误? - Why am I getting an error when using split function of javascript? 使用Material UI菜单时在控制台中获得警告。 给我建议解决方案。 我在文本对象中使用HTML - Getting a warning in Console when using Material UI menu. Suggest me solution. I am using HTML in text object 为什么使用“ semantic-ui-react”的“ Grid”组件时布局不正确? - Why am I getting incorrect layout when using the “Grid” component of 'semantic-ui-react'? Javascript-为什么在AngularJS中使用ng-if时出现此错误? - Javascript - Why I am getting this error when I am using ng-if in AngularJS? 从 React.js 中的 @material-ui/pickers 选择日期后出现错误 - i am getting error after i selecting the date from @material-ui/pickers in React.js 为什么当我生成错误时我收到字符串错误? - Why when i generate an Error i am getting an String Error? 为什么每次输入时使用 setAttribute() 都会出错? - Why am I getting error when using setAttribute() every time I type it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM