Answer the question
In order to leave comments, you need to log in
Why don't hooks work in hock?
Why doesn't this code work?
import React from 'react';
import { useSelector, useDispatch } from "react-redux";
import Loader from "../../components/share/Loader/Loader";
const WithLoader = (Component, get, block, type) => {
const dispatch = useDispatch();
React.useEffect(() => {
dispatch(get);
},[dispatch]);
const page = useSelector(state => state[block][type]);
return (page == null || page == undefined || page.length == 0)
? <Loader />
: <Component
content={ page }
/>
}
export {WithLoader};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question