Let's say I've two different components who share two selects that receive their data from the server through a controller:
function component1() {
return {
someArray: [],
someString: '',
someBoolean: false,
selectMethod1: function() {
window.livewire.emit('get_select_method1');
},
selectMethod2: function(someParameter, anotherParameter) {
window.livewire.emit('get_select_method2');
}
}
}
function component2() {
return {
someInt: 1,
selectMethod1: function() {
window.livewire.emit('get_select_method1');
},
selectMethod2: function(someParameter, anotherParameter) {
window.livewire.emit('get_select_method2');
}
}
}
In the above example I'm looking for the best way to reuse the methods "selectMethod1" and "selectMethod2" in both components (without the need to create a third element for the selects).