¡GoConqr estrena diseño! Cuéntanos qué te parece.

Módulo 9 de 13 · Multimedia

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.

Instrucciones

Para avanzar en el curso, envía un intento de este test. Puedes enviarlo después de la última pregunta.

Ir al módulo elegido

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?