I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
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
function get(path, obj, fb = `$\{${path}}`) { | |
return path.split('.').reduce((res, key) => res[key] || fb, obj); | |
} | |
function parseTpl(template, map, fallback) { | |
return template.replace(/\$\{.+?}/g, (match) => { | |
const path = match.substr(2, match.length - 3).trim(); | |
return get(path, map, fallback); | |
}); | |
} |
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 * as React from 'react'; | |
import { Component } from 'react'; | |
export default function HOCBaseRender<Props, State, ComponentState>( | |
Comp: new() => Component<Props & State, ComponentState>) { | |
return class HOCBase extends Component<Props, State> { | |
render() { | |
return <Comp {...this.props} {...this.state}/>; | |
} | |
} |
WebSockets is a modern HTML5 standard which makes communication between client and server a lot more simpler than ever. We are all familiar with the technology of sockets. Sockets have been fundamental to network communication for a long time but usually the communication over the browser has been restricted. The general restrictions
- The server used to have a permanent listener while the client (aka browser) was not designated any fixed listener for a more long term connection. Hence, every communication was restricted to the client demanding and the server responding.
- This meant that unless the client requested for a particular resource, the server was unable to push such a resource to the client.
- This was detrimental since the client is then forced to check with the server at regular intervals. This meant a lot of libraries focused on optimizing asynchronous calls and identifying the response of asynchronous calls. Notably t