Search code examples
javascriptreactjsreact-propsreact-component

If passing an OnChange() as a prop, can it receive multiple functions in the parent component on ReactJs?


I am newbie on React. I am passing this from child to parent component

   <div className="filter-module">
                <i className="fas fa-sign-in-alt icon"></i>
                    <input 
                        name= "availabilityFrom"
                        onChange={(e)=>handleDateIn(e.target.value, e.target.name)}
                        type="date" 
                 />
            </div>

and on the parent, passed as a prop, I'd like to use the same parameters to execute two different methods

 handleDateIn= {this.handleFilterInputsDates;this.handleFilterInputs}

But it is not working. Is it possible to make something similar? I've read many similar questions to mine here on SO, but any matched my doubt.

Thanks in advance! :D


Solution

  • well without me knowing react i guess you want:

    handleDateIn= function(v,n) {
       handleFilterInputsDates(v,n);
       handleFilterInputs(v,n);
    }