I apologize in advance, my English is bad. I am taking a course on react, and I want to rewrite this component to useSelector, but I can't. One of the props is bound to be undefined. Who can explain to me how to do this? I am also using the library "Reselect"
Code:
import React from "react";
import { connect } from "react-redux";
import CollectionItem from "../../components/CollectionItem/CollectionItem";
import "./CollectionPage.scss";
import { selectCollection } from "../../redux/shop/shop.selectors";
const CollectionPage = ({ collection }) => {
console.log(collection);
return (
<div className="collection-page">
<h2>COLLECTION PAGE</h2>
</div>
);
};
const mapStateToProps = (state, ownProps) => ({
collection: selectCollection(ownProps.match.params.collectionId)(state),
});
export default connect(mapStateToProps)(CollectionPage);