我正在尝试在我的Web应用程序中使用reactstrap依赖关系,但无法识别所有导入。
我尝试重新安装并检查了源文件夹中的依赖项,它们似乎还不错。我正在使用MERN堆栈,并且正在从客户端(反应端口3000)和服务器端(端口5000)运行这两个服务器。
import React, { Component } from "react";
import {
Collapse,
Navbar,
NavbarToggler,
NavbarBrand,
Nav,
NavItem,
NavLink,
Container
} from "reactstrap";
“ reactstrap”中的导入{...,...,...}在编辑器中已变为浅色,并且我收到一条消息,说明声明中的所有导入均未使用。
以下是package.json中的信息
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"bootstrap": "^4.3.1",
"jquery": "^3.4.1",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "3.0.1",
"react-transition-group": "^4.1.0",
"reactstrap": "^8.0.0",
"typescript": "^3.5.1",
"uuid": "^3.3.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"proxy": "http://localhost:5000",
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
答案 0 :(得分:0)
那只是您的编辑器告诉您,导入的组件实际上并未在文件中使用。尝试在代码中使用它们,警告就会消失。