Created
November 3, 2020 13:00
-
-
Save DesireeBesnard/3733949d5046621eb044b45be07bd0fc to your computer and use it in GitHub Desktop.
ES6 Classes, Fonctions an Destruct synthax
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
class Screen extends Component { | |
constructor(props) { | |
super(props) | |
this.state = { logginState: 'logged-out'} | |
} | |
render() { | |
} | |
} |
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
// const firstName = this.props.firstName | |
// const lastName = this.props.lastName | |
// const onClick= this.props.onClick | |
const { firstName, lastName, onClick} = this.props | |
const person = { | |
firstName: 'John', | |
lastName: 'Smith', | |
set fullName(fullName) { | |
// const names = fullName.split(' ') | |
// this.firstName = names[0] | |
// this.lastName = names[1] | |
[this.firstName, this.lastName] = fullname.split(' ') | |
} | |
} |
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
const adults = [] | |
const minors = [] | |
people.forEach((person) => { | |
if (person.age >= 18) { | |
adults.push(person) | |
} else { | |
minors.push(person) | |
} | |
}) | |
people.map((person) => person.firstName) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment