I am trying to pass a function from a parent view to a child view
In Parent
const getStartedPressed = () => {
console.log("Pressed")
}
return (
<ApplicationProvider {...eva} theme={eva.light}>
<WelcomeSliderScreen getStartedPressede={getStartedPressed} ></WelcomeSliderScreen>
</ApplicationProvider>
and in Child
const onGetStartedPressed = (): void => {
useEffect(() => {
// console.log('postArray',props.postArray.title)
console.log('postObject',props?.postObject?.getStartedPressed) // optional-chaining would take care of the undefined check
},[props?.postObject?.title])
}
<Button
style={styles.signUpButton}
appearance="ghost"
status="control"
onPress={onGetStartedPressed}
>
Get Started
</Button>
I am getting an error
Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function