This file contains hidden or 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 testFunction = () => 'hello there.'; | |
testFunction(); |
This file contains hidden or 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 HelloWorld = (props) => { | |
return <h1>{props.hello}</h1>; | |
} |
This file contains hidden or 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 HelloWorld extends Component { | |
render() { | |
return ( | |
<h1>{props.hello}</h1>; | |
); | |
} | |
} |
This file contains hidden or 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 developer = { | |
firstName: 'Nathan', | |
lastName: 'Sebhastian', | |
developer: true, | |
age: 25, | |
} | |
//destructure developer object | |
const { firstName, lastName } = developer; | |
console.log(firstName); // returns 'Nathan' |
This file contains hidden or 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:name } = developer; | |
console.log(name); // returns 'Nathan' |
This file contains hidden or 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 numbers = [1,2,3,4,5]; | |
const [one, two] = numbers; // one = 1, two = 2 |
This file contains hidden or 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 [one, two, , four] = numbers; // one = 1, two = 2, four = 4 |
This file contains hidden or 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 users = [ | |
{ name: 'Nathan', age: 25 }, | |
{ name: 'Jack', age: 30 }, | |
{ name: 'Joe', age: 28 }, | |
]; |
This file contains hidden or 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
import React, { Component } from 'react'; | |
class App extends Component { | |
// class content | |
render(){ | |
const users = [ | |
{ name: 'Nathan', age: 25 }, | |
{ name: 'Jack', age: 30 }, | |
{ name: 'Joe', age: 28 }, | |
]; |
This file contains hidden or 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
<ul> | |
{users | |
.filter(user => user.age > 26) | |
.map(user => <li>{user.name}</li>) | |
} | |
</ul> |