Aug 24, 2017 · 1 min read
Why are *Cached called *Cached and not just *? It would be more obvious to me if I could just call…
<div onClick={this.onTaskComplete(task.id)}>
{task.title}
</div>Could setupDelegate just do something along these lines…
export function setupDelegate(manager, ...methods) {
const delegate = manager.delegate
|| (manager.props && manager.props.delegate);
methods.forEach((method) => {
manager[method] = (function() {
if (delegate && delegate[method] === 'function') {
return delegate[method].apply(arguments);
}
}).bind(manager);
}
}I am probably overlooking something that all that function binding ho functions and caching is doing, but it does seem over complex.
