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
import React from 'react'; | |
import { useSpring, animated } from 'react-spring'; | |
const FadeIn=()=> { | |
const props = useSpring({ | |
opacity: 1, | |
from: { opacity: 0 }, | |
delay: '5000' | |
}); | |
return <animated.div style={props}><h1>I will fade in</h1></animated.div> |
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
// 1. Part of an app (not final API) | |
<React.unstable_ConcurrentMode> | |
<Something /> | |
</React.unstable_ConcurrentMode> | |
// 2. Whole app (not final API) | |
ReactDOM.unstable_createRoot(domNode).render(<App />); |
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 arr1 = [1, 2, 3]; | |
let arr2 = []; | |
for (let value of arr1) { | |
arr2.push(value * 10); | |
} | |
//print[10,20,30] | |
console.log(arr2) |
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 arr1 = [1, 2, 3]; | |
const arr2 = arr1.map(item => item * 10); | |
//print [10,20,30] | |
console.log(arr2); |
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 students =[ | |
{ | |
firstName:"Roei", | |
lastName:"Berkovich", | |
age:29 | |
}, | |
{ | |
firstName:"Matan", | |
lastName:"Yossef", | |
age:27 |
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 arr1 = [1,5,23,40,65,78,100]; | |
const arr2 = []; | |
for (let value of arr1) { | |
if(value >= 40) { | |
arr2.push(value); | |
} | |
} | |
//print [40,65,78,100] | |
console.log(arr2); |
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 arr1 = [1,5,23,40,65,78,100]; | |
const arr2 = arr1.filter(item => item >= 40); | |
//print [40,65,78,100] | |
console.log(arr2); |
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
import React, { useState, useEffect } from "react"; | |
const GetUsersFromGithub = () => { | |
const [users, setUsers] = useState([]); | |
async function fetchMyAPI() { | |
let response = await fetch("https://api.github.com/users"); | |
let users = await response.json(); | |
setUsers(users); // set users in state | |
} |
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
import React, { useState } from "react"; | |
const GetUsersFromGithub = () => { | |
const [users, setUsers] = useState([ | |
{ | |
id: 0, | |
name: "Roei" | |
}, | |
{ | |
id: 1, |
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 arr = [5, 7, 1, 8, 4]; | |
const sum = arr.reduce((accumulator, currentValue) => accumulator + currentValue); | |
// prints 25 | |
console.log(sum); |