'How to handle onChange when creating reusable components in react js
I have created a reusable component MobileInput. And the below code is being used inorder to use it into another component
MobileInput name={‘mobileInput’} Label={‘phn’} onChange={handleMobileInput}
*I am confused like the onchange function which is handleMobileInput needs to declared in the page wherein this MobileInput reusable ftn is getting called. Or in MobileInput reusable component itself *
Solution 1:[1]
you will create this function "handleMobileInput" in which screen you are call you component and then pass it in props
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | RoshaanAli |
