I have a function component that uses hook useEffect() for dispatch action from redux. I get the action from props, it comes there from mapDispatchToProps.
const AdmRegion = props => {
useEffect(() => {
const { fetchRegionsListRequest } = props;
fetchRegionsListRequest();
}, []);
useEffect(() => {
console.log("render page");
});
return (
<>
</>
);
};
const mapStateToProps = ({ regions }) => ({
regionsList: regions.list
});
const mapDispatchToProps = {
fetchRegionsListRequest
};
export default connect(mapStateToProps, mapDispatchToProps)(AdmRegion);
This action triggers the renderer three times. Is this normal behavior, or can the number of re-renders be somehow reduced? I don’t quite understand why three times. According to the action fetchRegionsListRequest, a saga is triggered which receives data from the server and puts the redux store console log screenshot