When working with React, it's a common practice to bind parameters for child components in the following manner:
<Child onChange={e =>
doThing(complex.variable.inParentScope[3], e.target.value)} foo="bar" />
In Vue, I want to achieve a similar functionality to ensure that child components remain as simple as possible (just needing to call onClick={(e) => onChange(e)}
. However, I've come across information suggesting that passing functions as props is not recommended in Vue. I am struggling to figure out how to bind the arguments from the parent component to make the code reusable. Ideally, I would like to do something like this:
[1,2,3,4,5,dataFromAPI].map(data =>
<Child change=& quot;e => handleChange(data, foo, e.target.value) />
Can someone provide guidance on how to achieve this?