skip to Main Content

Javascript – React circular dependencies w/ useState

I have two useState state values currently, and they rely on each other. Here's some pseudocode: [getId, setId] = useState(); [getSearchParam1, setSearchParam1] = useSearchParams(); useEffect(() => { setId(getSearchParam1) }, [getSearchParam1]) useEffect(() => { setSearchParam1(getId) }, [getId]) where searchParam1 is just…

VIEW QUESTION
Back To Top
Search