warning while using react-redux should i ignore

let me know if code is required
No description
7 Replies
ἔρως
ἔρως14mo ago
code is mandatory
Anonymous DEV
Anonymous DEVOP14mo ago
GitHub
aptech-projects/cardCrafters at main · AnonymousDEV001/aptech-proje...
Contribute to AnonymousDEV001/aptech-projects development by creating an account on GitHub.
Anonymous DEV
Anonymous DEVOP14mo ago
function Statistics() {
const state = useSelector((state) => state);

const [details, setDetails] = useState({
totalMessages: 0,
totalImages: 0,
});

useEffect(() => {
if (state.dashboard.usersMessages !== null && state.productFetch.productDetails.products !== null) {
setDetails({
totalMessages: state.dashboard.usersMessages.length,
totalImages: state.productFetch.productDetails.products.length,
});
}
console.log("hi")
}, [state.dashboard.usersMessages, state.productFetch.productDetails.products]);
function Statistics() {
const state = useSelector((state) => state);

const [details, setDetails] = useState({
totalMessages: 0,
totalImages: 0,
});

useEffect(() => {
if (state.dashboard.usersMessages !== null && state.productFetch.productDetails.products !== null) {
setDetails({
totalMessages: state.dashboard.usersMessages.length,
totalImages: state.productFetch.productDetails.products.length,
});
}
console.log("hi")
}, [state.dashboard.usersMessages, state.productFetch.productDetails.products]);
this is rendering 6 times for some reason
Anonymous DEV
Anonymous DEVOP14mo ago
No description
Anonymous DEV
Anonymous DEVOP14mo ago
anything else?
ἔρως
ἔρως14mo ago
i know nothing about react or redux, but i found this: https://stackoverflow.com/a/76492947
Stack Overflow
Selector memoized returned the root state when called. Redux-ToolKit
I'm using useSelector of reduxtoolkit and everytime I run my app. My app re-renders 5 times and I keep on getting this error. I cant seem to find a way too get rid of this error. Selector memoized
ἔρως
ἔρως14mo ago
my guess is that it is related to this: const state = useSelector((state) => state);
Want results from more Discord servers?
Add your server