New course! Every coder should learn Generative AI!
Try a free lesson+ 1
you could have a variable set to 0 when on the first page.
When the user clicks the button you check the variable and if it is 0 you show page2 and set the variable to 1;
if the variable is 1 you show page1 and set it back to 0:
var x = 0;
const create = () => {
if (x == 0) {
x=1
//show page2
} else {
x=0
//show page 1
}
}
obviously you would have to change the variable name