Here给出了如何从模块导入某些类的示例:
import {ModalContainer, ModalDialog} from 'react-modal-dialog';
但是,PhpStorm(最新的 EAP)给我一个错误:
我使用 npm install react-modal-dialog
安装了这个包,它存在于 node_modules
中。
等效的 var {ModalContainer, ModalDialog} = require('react-modal-dialog');
工作正常。
最佳答案
我在设置 React 项目时遇到了这个问题,我所做的只是下载导入的 typescript 定义,在我的例子中只是搜索了 react
。
可以在 webstorm's help page 上找到有关将库添加到项目的说明。 .
关于javascript - 使用 ES6 "Cannot resolve symbol"语法时为 `import`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35741847/