Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

How to have multiple pages/layouts under the same endpoint in Svelte?

$
0
0

I will preface this question by stating I am not a frontend developer.

I am developing a pet project, where I have a form, and when the form is submitted, the user advances to the next "stage".

For example, a user fills in some basic info, uploads a file, and then in the next page I render the info that the user filled in. I would like all of this to happen under the /app endpoint.

How does this look like in practice? What's the proper way of developing a page that has multiple "pages" so to say? What are the appropriate terms so I can google more about this?

Right now I have something that looks like this, but I really dislike it.

<script>  let currentStep = 0;  let maxSteps = 3;  function handleNextStep() {    if (currentStep < maxSteps) {      currentStep++;    }  }</script>{#if currentStep === 0}<Form nextStep={handleNextStep} />{:else if currentStep === 1}<Render nextStep={handleNextStep} />{:else if currentStep === 2}<App />{/if}

The problem with this is that if I refresh the page I will lose the "progress", and overall it doesn't look good I think.


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>