Created
May 13, 2018 00:38
-
-
Save radiegtya/552e1cdd146f1d5c34067a5560ff0065 to your computer and use it in GitHub Desktop.
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
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