skip to Main Content

Does useEffect in Reactjs fetch data based on URL changes?

I am using two URLs: localhost:3000/content localhost:300/content/<projectId>. My routes are: <Route path="/content" element={ <RequireAuth> <ContentPage /> </RequireAuth> } /> <Route path="/content/:projectId" element={ <RequireAuth> <ProjectPage /> </RequireAuth> } /> When I am going sequentially, its working perfectly. But when I am…

VIEW QUESTION

Can I make changes?

I'd like to implement the equivalent to the javascript localStorage in my React Native app. But I'm unsure how to set. To function how I want it to, I would like the localStorage to be stored every time the app…

VIEW QUESTION

How can I rewrite this?

Considering such code below: const [list, setList] = useState([]); const [curPage, setCurPage] = useState(0); const fetchItem = useCallback(async ()=>{ const data = await callAPI(); // data is an object setList(prev => [...prev, data]); },[]); useEffect(()=>{ if(list.length - 1 < curPage)…

VIEW QUESTION
Back To Top
Search