This is basically a doubt. I am new to React-Native. I have a code something like this:
function MainFunction(){
console.log("A")
....code...
async function apiFunction(){
console.log("B")
....code...
}
useEffect(()=>{
apiFunction()
},[])
return(
...JSX code...
)
}
export default MainFunction;
Now I see that the B is printed only once, which is well and good. But I see that A gets printed multiple times. Is it normal or I messed up with the code? If normal, why so? If messed up, well I will try to fix it.
Thanks
Yes It's normal because every time this component is re-rendered execute all this code, so you will have n console.log('A') where n is re-render times.