Skip to content

Instantly share code, notes, and snippets.

@lushiyun
Last active September 26, 2020 22:13
Show Gist options
  • Save lushiyun/42ef1861b95fe84af31e8606e3cf3849 to your computer and use it in GitHub Desktop.
Save lushiyun/42ef1861b95fe84af31e8606e3cf3849 to your computer and use it in GitHub Desktop.
... // omitted other imports
import { selectMessagesByTeam } from './messagesSlice'
import { useSelector } from 'react-redux'
import MessageItem from './MessageItem'
const MessagesList = () => {
...
const messages = useSelector((state) => selectMessagesByTeam(state, teamId))
const renderedMessages =
messages &&
messages.map((message) => (
<MessageItem key={message.id} message={message} />
))
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment