Why might componentDidMount() not work in a React container if I try to call a component again?
There is a list of links like
<Link key={element.name} to={'elements/:element'}} /> from the link, I take the name of this element and pass it to the props ElementDetail container (conditionally)
<ElementDetail name={:element} /> I already use the name from props inside the componentDidMount() method:
@connect( state => ({ element: state.element }), dispatch => ({elementActions: bindActionCreators(elementActions, dispatch)}) ) export default class ElementDetail extends React.Component { componentDidMount() { console.log('>>> CDM') let { getProperties } = this.props.elementActions; getProperties(this.props.name) } render() { let { properties, isLoading } = this.props.element; let propertyGroups = properties['properties']; console.log('>>> RENDER') return <div /> When you first mount the component, the code works as needed.
However, when I try to call the component c with other data via Link, I only get an update of the address in the browser and the change of props.name . Only the code inside render () works, as I see from the console output. Where do I make a mistake?