const React = /* Implement this */;
function HelloComponent(){
const [myNumber, setMyNumber] = React.useState(0);
// Simulate rendering data to a screen
console.log("My number:", myNumber);
// Simulate rendering a clickable button
const click = ()=> setMyNumber((num)=> num + 1);
return click;
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
// A simple async function that resolves immediately | |
let asyncFn = ()=> { | |
let handlers = (resolve, reject)=> { | |
resolve(); | |
} | |
return (new Promise(handlers)); | |
} | |
// Lack of default block scoping can be confusing. Especially with for loops | |
// Say, someone might start with this: |