Skip to content

Instantly share code, notes, and snippets.

View MehulATL's full-sized avatar

Mehul Patel MehulATL

View GitHub Profile
@kentcdodds
kentcdodds / sequential-promises.js
Created June 12, 2018 15:11
Different mechanisms for making async work sequential.
// code for my devtip on 12 June 2018:
// https://www.youtube.com/watch?v=0wiM3jW1DVY&list=PLV5CVI1eNcJgCrPH_e6d57KRUTiDZgs0u
const loadFile = file => {
return new Promise(resolve => {
setTimeout(() => {
resolve(`contents of ${file}`)
}, 500)
})
}
const files = ['01.md', '02.md', '03.md', '04.md', '05.md']
@dabit3
dabit3 / reactstreaming.js
Last active November 10, 2022 04:46
React Streaming code from live broadcast
import React from 'react';
import logo from './logo.svg';
import './App.css';
import ReactPlayer from 'react-player'
import { HashRouter, Link, Switch, Route } from 'react-router-dom'
import AuthComponent from './AuthComponent'
import { Auth, API } from 'aws-amplify'
import { createComment as CreateComment } from './graphql/mutations'
import { listComments as ListComments } from './graphql/queries'
import { onCreateComment as OnCreateComment } from './graphql/subscriptions'