mk-react-images
Version:
A simple, responsive lightbox component for displaying an array of images with React.js
16 lines (12 loc) • 295 B
JavaScript
/**
Bind multiple component methods:
* @param {this} context
* @param {Array} functions
constructor() {
...
bindFunctions.call(this, ['handleClick', 'handleOther']);
}
*/
export default function bindFunctions (functions) {
functions.forEach(f => (this[f] = this[f].bind(this)));
};