-
-
Save mutewinter/2fdd117320b4569e71f9 to your computer and use it in GitHub Desktop.
MessageList
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@listenToFirebase((props) => ({ | |
callback: (dataSnapshot) => { | |
let messages = []; | |
dataSnapshot.forEach((childSnapshot) => { | |
messages.push( | |
Message.fromDataSnapshot(childSnapshot, { battleId: props.battleId }) | |
); | |
}); | |
return messages; | |
}, | |
propName: 'messages', | |
loadingJSX: <div className="tc ptxxl">Loading messages…</div>, | |
missingJSX: <div className="tc ptxxl">No messages yet</div>, | |
ref: messagesRef().child(props.battleId) | |
}), { | |
battleId: PropTypes.string.isRequired | |
}) | |
export default class MessageList extends Component { | |
// Will have access to an array of messages, guaranteed. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment