My idea is that <LandingPage> has <Top> and it is altered by user clicking progress.
<Top> has pageState, then it is changed by button clicking in First and Second page
Is it correct practice? and How can I change the pageState of Top by clicking the button in First and Second page ??
These are what I made so far
export default function LandingPage(props) {
return (
<div>
<Header></Header>
<Top></Top>
<Footer></Footer>
</div>
);
}
const Top = (props) =>{
const [pageState, setPageState] = useState([]);
if (pageState == 1){
return (
<Second></Second>
)
}
elif (pageState == 2){
return (
<Third></Third>
)
}
else {
return (
<First></First>
);
}
}
const First = (props) => {
const classes = useStyles();
return (
<Button size="lg" color="success" style={{margin:"50px"}} onClick={()=>***}>
Move to Second page!</Button>
)
}
const Second = (props) => {
return (
<Button size="lg" color="success" style={{margin:"50px"}} onClick={()=>***}>
Move to Third page!!</Button>
);
}
const Third = (props) => {
return (
<div>Third Page</div>
);
}