import { ChatEngine, ChatFeed } from 'react-chat-engine';
import ChatFeed from './components/chatFeed';
import './App.css';
const App = () => {
return(
<ChatEngine
height="100vh"
projectID=""
userName=""
userSecret=""
renderChatFeed={(chatAppProps) => <ChatFeed {...chatAppProps} />}
/>
);
}
export default App;它在服务器运行时显示错误
SyntaxError: D:\PROJECTS\APPLICATION\chat_app\src\App.js: Identifier 'ChatFeed' has already been declared. (3:7)
1 | import { ChatEngine, ChatFeed } from 'react-chat-engine';
2 |
> 3 | import ChatFeed from './components/chatFeed';
| ^发布于 2021-05-19 20:41:38
错误消息说明了一切,您声明了ChatFeed两次。
您可以通过以下两种方式进行修复:
像import { ChatEngine, ChatFeed as ChatFeedComp } from 'react-chat-engine';一样,
react-chat-engine的命名导入当然,您可以随意使用您喜欢的任何名称
https://stackoverflow.com/questions/67603394
复制相似问题