I'm currently facing a weird issue where the HOC withRouter
provided by react-router
does not pass on the props to the mapStateToProps function. Am I doing it wrong here?
import React, { Component } from 'react';
import { Link, withRouter } from 'react-router';
import { connect } from 'react-redux';
class ThisClass extends Component {
render() {
console.log(this.props.router); // Returns object with router keys (params, router, go, routes, ...)
// Render stuff
}
}
const mapStateToProps = (state, props) => {
console.log(state); // returns state of redux
console.log(props); // returns empty object -> {}, how come this is empty?!
return {
consultations: patientThisClassSelector(state, props)
};
}
export default connect(mapStateToProps)(withRouter(ThisClass));