首页 > 解决方案 > react 聊天引擎中的 renderChatFeed 属性正在渲染自定义聊天提要组件的无限循环

问题描述

//App.js file    
    import {ChatEngine} from "react-chat-engine";
    import './App.css';
    import ChatFeed from "./components/ChatFeed";
    
    const App =()=> {
  
  return (
    
     <ChatEngine
       height="100vh"
       projectID="0e3104a3-d472-4764-9990-2845352801b9"
       userName="Admin"
       userSecret="123123"
       renderChatFeed={(chatAppState) => <ChatFeed {...chatAppState}/>}
       //renderChatFeed={(chatAppProps)=>{ return <ChatFeed {...chatAppProps}/>}}
     />
   
  );
}


//ChatFeed component file
const ChatFeed = (props) => {
    console.log(props);
    return (
    <div>
      ChatFeed
    </div>);
}
 
export default ChatFeed;

我正在使用使用 renderChatFeed 函数的自定义 chatFeed 组件,但聊天提要组件不会停止呈现我不明白是什么问题

标签: reactjs

解决方案


推荐阅读