Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

162
Vistas
Why react-router fires push and pop action when replacing path?

I've a react app. In a component I have a Link comp from the react-router. When I click on the link the router fires a push and a pop action? Is it normal? This way I don't know how can I solve a problem. I have a route setup like this: example/:param and when I'm on this path how can I listen properly for the param segments change?

Code:

class Example extends Component {
    fetch(param) {
        // ajax stuff
    }
    componentWillMount() {
        this.fetch(this.props.param);
    }

    componentWillReceiveProps(nextProps) {
        this.fetch(nextProps.param);
    }

    render() {
        // render stuff
    }
}

const stateToProps = (state, ownProps) => {
    return {
        param: ownProps.params.param,
    };
};

export default connect(stateToProps, {})(Profile);

This way componentWillReceiveProps runs twice beacuse router fires push and the pop action.

Thx for any help/advice, Akos

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda