I am using Redux hooks. I am tried to dispatch from useEffect, but get error "Maximum update exceeded"
const state = useSelector((state: RootStateOrAny) => ({data: state}));
const dispatch = useDispatch();
React.useEffect(() => {
if (state.data.topics.topics === null) dispatch({type: 'GET_TOPICS'});
console.log(state.data.topics.topics)
}, [dispatch, state]);