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 handleSubmit = async e => { | |
e.preventDefault(); | |
if (password !== confirmpassword) { | |
console.log('Password does not match'); | |
} else { | |
const newUser = { | |
name, | |
email, | |
password | |
}; |
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'; | |
class App extends React.Component { | |
state = { | |
text: '', | |
todos: [] | |
}; | |
handleChange = e => { | |
e.preventDefault(); |
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
export const fruits = [ | |
'🍇', | |
'🍈', | |
'🍉', | |
'🍊', | |
'🍋', | |
'🍌', | |
'🍍', | |
'🍎', | |
'🍏', |
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 fs = require('fs'); | |
// create my own fetch function | |
const myFetch = path => { | |
return new Promise((resolve, reject) => { | |
let data = { | |
obj: fs.readFileSync(path, 'utf8'), | |
toJSON() { | |
return new Promise((resolve, reject) => { | |
resolve(JSON.parse(this.obj)); |
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 getData = url => { | |
return new Promise((resolve, reject) => { | |
fetch(url) | |
.then(response => resolve(response.json())) | |
.catch(error => reject(error)); | |
}); | |
}; | |
const promise1 = getData('https://jsonplaceholder.typicode.com/users'); | |
const promise2 = getData('https://jsonplaceholder.typicode.com/posts'); |
NewerOlder