I have two component that one passes some func as prop to another and I am not sure what is the proper way to do this without having to receive an eslint error:
Code:
<Parent> const doSmthHandler = useCallback((id: number)=> { //do some stuff },[]) <ComponentB> doSmth={()=>doSmthHandler(id)} // Here I get eslint warning: JSX props should not use arrow functions eslint warning </ComponentB> </Parent> Component B receives doSmth prop as function and has a button such as:
<Button onPress={doSmth}>Do stuff</Button> I wonder how do I pass some argument into the cuntion passed as cb prop into another component that I dont get eslint errors!
useCallback? You can find documentation for it here