티스토리 뷰

 

 

https://stackoverflow.com/questions/64718224/useeffect-loop-due-to-useselector-updating

 

useEffect loop due to useSelector updating

I have a useEffect function Component () { const facets = useSelector(getFacets) useEffect(() => { dispatch(search(facets, param2, param3)) }, [dispatch, facets, param2, par...

stackoverflow.com

 

Sooooo Redux has a few store methods; dispatch being one of them. For me, the store method I was looking for was getState. More info if you look here and cmd/ctrl + F 'getState'

I didn't think I could access the state within my slice because React would not allow me to use useSelector within the slice for obvious reasons. What was not obvious to me at the time was that I could gain access with getState

 

 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/12   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
글 보관함