O GoConqr está de visual novo! Conte para nós o que você achou.

Módulo 9 de 13 · Mídia

Reset the state after unmount

Kostas Diakogiannis

Reset the state after unmount

Reset the state after unmount

The previous solution works well for now, but generates a specific problem.

Now that the shouldRedirect is set to true, will stay like that forever. That means if we navigate to this component again, we are going to redirect immediately and not after 5 seconds, since the value is true and this fact will trigger the Redirect component.

What you should do, is reset the shouldRedirect state's value again to back to false, immediately after the component unmounts. 

Hint: Maybe you will find componentWillUnmount lifecycle method extremely useful here.

Instruções

Para avançar no curso, envie uma tentativa deste quiz. Você pode enviá-la depois da última pergunta.

Ir para o módulo escolhido

Fale Conosco

Sobre o que é sua mensagem?

O que você acha do novo visual?

Você gostou?