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 [paragraphArr, setParagraphArr] = useState<JSX.Element[]>([]); |
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
{paragraphArr.length > 0 && <Paragraph/>} |
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 [difficultyLevel, setDifficultyLevel] = useState<number | undefined>(); |
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
{difficultyLevel === undefined && <DifficultyLevel />} |
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 [timeInSeconds, setTimeInSeconds] = useState<number>(); |
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
{timeInSeconds as number > 0 ? <Timer/> : <Duration/>} |
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 handler = { | |
get: async (target, date) => { | |
if(target[date]){ | |
return target[date]; | |
} | |
else{ | |
const dataRaw = await fetch(`https://api.nasa.gov/planetary/apod?api_key=${apiKey}&date=${date}`, { | |
method : "GET", | |
mode: 'cors', | |
}); |
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 proxyObj = new Proxy(getTargetObj(), handler); |
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 handler = { | |
set: function (target, property, value){ | |
if(property === "age"){ | |
if(typeof value == "string"){ | |
alert("Cannot assign String to age, use Number only"); | |
} | |
else{ | |
target[property] = value; | |
} | |
} |
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 handler = { | |
get: function(target,property) { | |
if(property === "name"){ | |
return `Name of the person is ${target[property]}` | |
} | |
}, | |
} |