Did you get it?
yep... but isn't it rare? or better say, what are the use cases for this?
I use it quite often for saving temporary data in closure
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures
It's called higher order function pattern.
One case is action creator function in Redux thunk that you need to return another function to do asynchronous stuff
is "higher order function" term that "first class function" term ?
Yes . Where I see it was in a react native project to pass some argument as first parameter and then a dispatch function , so it makes sense in that case .
I use redux Thunk brainless at this point . In this case was using it with useReducer , then I realized that it is what redux Thunk does
Обсуждают сегодня