I have a login page, after logging in I am able to navigate to my home page. But I also want to pass props when navigating to home page.
Login Page:
const [daysLeft, setDaysLeft] = useState(14);const getHome = () => { props.navigation.replace(NavigateTo.Main, {screen: NavigateTo.Home, daysLeft: daysLeft});};
After this I am running my login api, and checking if phone is verified or not:
if (!user.is_phone_verified) { getEmailVerification();} else { getHome();}
Here my phone is verified and my getHome()
is executed, taking me to my home page.
Home Page:
const HomeScreen = (props: any) => {useEffect(() => { console.log("days: ",props.daysLeft); }, []); // Remaining code
But I am getting days: undefined
in my console. I am new to using react native and I have been trying to figure out what I am doing wrong, but I don't know what I am doing wrong. Please help me.