Can someone please guide/refer the JS concept that I need to go through to undertand below.
I have below code snippet in my Application. It looks like it is returning a function dAFCreate
, but I see no where else we are calling the function dAFCreate
( I am expecting some funtion call like DAF.foo.dAFCreate();
but there is not such call happening)
I tried googling why return arrow functions in functions but did not get any relevant info
export class DomainAction implements Action {
constructor(public type: string = "", public payload: string) {}
}
export class DAF {
public static foo(type: string, defaultPayloadValue: any) {
const dAFCreate = (payload: T): Action => {
//do something, intialize _payload
return new DomainAction(type, _payload);
};
return dAFCreate;
}
}