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
| import React, { Component } from 'react' | |
| import io from 'socket.io-client' | |
| import FontAwesome from 'react-fontawesome' | |
| import Footer from './Footer' | |
| import './App.css' | |
| const API_URL = 'http://127.0.0.1:8080' | |
| const socket = io(API_URL) | |
| export default class App extends Component { |
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
| export default class App extends Component { | |
| // previously written lifecycle and custom methods | |
| // .... | |
| render() { | |
| const { name, photo} = this.state.user | |
| const { disabled } = this.state | |
| return ( |
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
| export default class App extends Component { | |
| // previously written lifecycle methods | |
| // .... | |
| // Routinely checks the popup to re-enable the login button | |
| // if the user closes the popup without authenticating. | |
| checkPopup() { | |
| const check = setInterval(() => { | |
| const { popup } = this |
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 arrToManipulate = [3, 5, 9, 2] | |
| const atIndex = arr => { | |
| const retArr = [] | |
| for(let i = 0; i < arr.length; i ++) { | |
| let total = 1 | |
| for (let j = 0; j < arr.length; j++) { | |
| if(j !== i) { | |
| total *= arr[j] |
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 arrToManipulate = [3, 5, 9, 2] | |
| const atIndex2 = arr => { | |
| let total = 1 | |
| const retArr = [] | |
| for(let i = 0; i < arr.length; i++) { | |
| total *= arr[i] | |
| } |
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 arrToManipulate = [] | |
| for(let i = 0; i < 50; i++) { | |
| arrToManipulate.push(Math.ceil(Math.random() * 10)) | |
| } | |
| // previously written atIndex function | |
| // previously written atIndex2 function | |
| console.time('one') |