2

I am working with svelte on a personal project (springboot + svelte + heroku). I have hardtime understanding why a component does not refresh when I am tryig to redisplay it :

here is a gist : https://svelte.dev/repl/a69ac7502677400081122453aa45dfbb?version=3.7.1

first app displays component First clicking [forward] display component Second. But then clicking [backward] does not bring back component First as I expect.

My general idea is using svelte to manage a tab oriented app : each tab is a component and sub-components. clicking on tab would display and hide tab components. even though it works great for the first tab changement next fails.

I 'm pretty sure it's possible to get such behavior, But I guess I must have misunderstood something...

Could someone epxlain me ?

Thanks

1 Answer 1

5

In you second component you are dispatching gothird

function forw() {
    dispatch('gothird');
}

but you are still using the on:next prop when using the component

<Second on:back={ back } on:next={gothird}/>

You need to update one or the other so that you are using the event you are actually dispatching from your component.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.