A thunks is a function that contains all of the context (state, functions, etc) it will need in order to carry out some sort of logic in the future.
Another way to say that, they are a function closure that begins with all of the arguments it will need in order to execute. You just don’t want to execute it now, it will be sometime in the future.
const add = (x,y) => x + y;
const thunk = () => add(1,2);
thunk() // 3
const addAsync = (x,y,callback) => {
setTimeout(function() { callback(x + y) }
}
var thunk = (callback) => addAsync(10,15,callback);
thunk( function() {
sum; // 25
}