React, Redux: Cannot read properties of undefined (reading ...)
Solution 1:
When you access the query add the optional chaining operator like so: this.props.query?.id
and in mapStateToProps
you are putting state.query.query
thus inside the JSX you can access to the id
directly: this.props.query?.id
otherwise it will throw an error like you've mentioned.
And when you need to use any variable inside the JSX you should put it inside a curly braces for example:
<li>{this.props.query?.id}</li>