A single component that leads to different pages depending on the page it appears.

Hello! I'm building a “quiz” app that have multiple pages with questions.

Each of these pages have multiple buttons that corresponds to the alternatives. If the user chooses the right alternative, a popup (bottom sheet) appears and this popup have a button to lead the user to the next page (next challenge). My question is:

As long as i have multiple of these pages, how can i lead the user to another page? I know i can duplicate the component (popup) multiple times and link each of them to the next page. But is it the best way to do it?

Is there a way to have a single component that do all the job? For example: if the user is on page 12, then the button leads to page 13, if on page 42 the the same button leads to page 43. Is it possible? How can i do that? 

Thanks in advance!

1
2 replies