Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

66
Vistas
See list of history through react-router props

I currently have a button that onClicks to history.goBack but I want it to direct the user to another path if there isn't a previous page (in the case the user visits the page directly by typing in the URL in the URL bar instead of clicking within the site to get there). When I checked out this.props.history there isn't an object containing the history of pages visited or a boolean that tells me if there is a page for history.goBack to work on. How do I check that? Looking at the docs for history library, there is suppose to be an entries property but this somehow didn't make it into react-router.

8 months ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can use go() property to move further back. Eg. go(-1) will be equivalent of goBack() and go(1) will be equivalent of goForward(). I don't think there is a way to list all the paths on the stack, but you could allways implement history that you can push to and control.

8 months ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos