Friday, 26 May 2017

React/Firebase accessing information from a button press

I am trying to access information from a previous post on a button press. I have sending messages functioning but want to add several buttons on each post (ex. like, share, message, etc) but I do not know quite how to do so.

Props.jsx

const Post = (props) => (
<div className="panel panel-default post-body">
    <div className="panel-body">
        {props.postBody.map((postPart, idx) =>(
            <div>{postPart}</div>
            )
        )}
        <div className="media-buttons">
            <button className="btn btn-default post-editor-button-like">Like</button>
            <button className="btn btn-default post-editor-button-share">Share</button>
            <button className="btn btn-default post-editor-button-view" >View</button>
            <button className="btn btn-default post-editor-button-message" onClick={() => { getInfo(props)}}>Message</button>
        </div>
    </div>
</div>

auth.js

export function getInfo(postKey){
console.log(postKey);
return ref.child(`post/${postKey}/message`)
}

I would have posted images of the message system and the firebase database but I do not have the reputation yet. so here are links to the images http://imgur.com/Ktk6PTp (firebase) http://imgur.com/0Wlwcdu (message board)

from the message board picture I am trying to just access the key for each individual message. If I am not clear on what exactly I am trying to do or if more code snippits are needed let me know! Thank you!



via surferfan

No comments:

Post a Comment