I know it is bad practice to use inline arrow function in react component.
But what should I do when my function has arguments ?
e.g. in CustomInput
I have a function to handle focus state and has an argument. I use it in onBlur and onFocus and pass parameter to it.
const CustomInput = () => {
const [focused, setFocused] = useState(false);
const handleFocus = (isFocus) => {
/**
* Some Conditions to check
*/
setFocused(isFocus);
};
return (
<input
onFocus={() => handleFocus(true)}
onBlur={() => handleFocus(false)}
/>
);
};