What does this functional construction (function returns function) mean?

Have this lines of code that quite hard for me to understand:

const useUserDataStore = dataSelector => useMSTStore(USER_DATA_STORE_TREE_PATH_NAME, dataSelector);
const useCurrentPhoneNumber = () => useUserDataStore(store => store.phoneNumber);

The exact part that I want to check is passing (store => store.phoneNumber) to useUserDataStore function as argument. Do I understand it correctly? We take store and extract phoneNumber field and pass its value to the useUserDataStore function? And as a result useCurrentPhoneNumber function returns just a phone number?

Will appreciate any help! Thanks

Source: Ask Javascript Questions

LEAVE A COMMENT