-
I am using autoCompletejs and it works as intended when following the instructions. However, due to limitations in my current task, I am trying to assign the arrow function to a const to use that instead of the arrow function. My approach looks somewhat like this: const ExternalFunction = async (query) => ... the rest of the arrow function from inside the autocomplete instance. Then instead of data: I try data: but instead of beeing called every time it gets called only once, when the page is first built but not when I type in the corresponding field. I also tried async function ExternalFunction(query){... But that produced the same behaviour as described above. Does anybody have an idea why the function, when stored, only gets called once even though it contains the very same code as the arrow function used in the working version? And more importantly, is there a solution for my approach of using an external function. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Figured it out. Instead of assigning the function to a variable and trying to call that, have the return value of a named function be the arrow function. function ExternalFunction(foo,bar){return async (foo,bar) => ...} |
Beta Was this translation helpful? Give feedback.
Figured it out.
Instead of assigning the function to a variable and trying to call that, have the return value of a named function be the arrow function.
function ExternalFunction(foo,bar){return async (foo,bar) => ...}