Skip to content

Instantly share code, notes, and snippets.

View sachinKumarGautam's full-sized avatar
🍷
Frontend Engineer, Love ReactJs

Sachin Kumar sachinKumarGautam

🍷
Frontend Engineer, Love ReactJs
View GitHub Profile
@MiguelCastillo
MiguelCastillo / bind.js
Last active May 28, 2023 12:20
Bind polyfill
/**
* Function bind polyfill
* https://github.com/ariya/phantomjs/issues/10522
*/
if (!Function.prototype.bind) {
Function.prototype.bind = function (context /* ...args */) {
var fn = this;
var args = Array.prototype.slice.call(arguments, 1);
@sachinKumarGautam
sachinKumarGautam / event-litsener-for-list.js
Created October 8, 2018 06:18
Optimized event litsensers for list for litseners
class SomeComponent extends React.PureComponent {
// Each instance of SomeComponent has a cache of click handlers
// that are unique to it.
clickHandlers = {};
// Generate and/or return a click handler,
// given a unique identifier.
getClickHandler(key) {