Let say I have an input field with suggestions : when I type, it suggest some possible inputs either by calling an API or in a predefined list.
So I need a massage to pass to an update method to handle the ‘oninput’ event, a function which returns a list of suggestions from the input and a view element, like an input field to display the value and the list of suggestions.
Question : how can I make this code reusable to have many fields like that without duplicating everything ?
My question is not very precise because I don’t exactly know how to call that capability : generic, dispatch, composition, components, younameit.
Basically what I want to do it to attach a suggestion function to an input field, this for many fields and functions (or partial function).
Thanks for your hints