JSFiddle - React, Tailwind, and code Playground
JavaScript
function bindContext(fn, that) {
return function() {
return fn.apply(that, [].slice.call(arguments));
}
}
function x(a, b, c) { return [this.test, a, b, c]; };
var that = { test: 1 };
var result = bindContext(x, that)(10, 20, 30);
console.log(result); // [1, 10, 20, 30]