Skip to content

Instantly share code, notes, and snippets.

@radiegtya
Created May 13, 2018 00:38
Show Gist options
  • Save radiegtya/552e1cdd146f1d5c34067a5560ff0065 to your computer and use it in GitHub Desktop.
Save radiegtya/552e1cdd146f1d5c34067a5560ff0065 to your computer and use it in GitHub Desktop.
render(){
// #1. replace the position and education with array from REST API Backendless
// const {name, position, education, summary, profilePicture, bgPicture} = this.state.data
const {name, experiences, educations, summary, profilePicture, bgPicture} = this.state.data
// #2. get the latestExperience from experiences array, we also use error checking (note: we also use ES6 concatination, don't confuse with it)
const latestExperience = experiences? experiences[0]: null
const position = latestExperience? `${latestExperience.position} at ${latestExperience.companyName}`: '-'
// #3. get the latest education from educations array
const latestEducation = educations? educations[0]: null
const education = latestEducation? latestEducation.school: '-'
// ... THE REST OF RENDER METHOD
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment