I do wonder whether sometimes the code here is using trendy tools just to be trendy, though. For example, is
const getDistance = (state, rotate) =>
["x", "y"].reduce((object, axis) => {
object[axis] = Math.abs(state[axis] + rotate[axis]);
return object;
}, {});
really an improvement on grandpa's version function getDistance(state, rotate) {
return {
x: Math.abs(state.x + rotate.x),
y: Math.abs(state.y + rotate.y)
};
}
?