encapsulating some routes to other component in react-router-dom v6

Advertisements I m using react and i have app.js like this: function App() { const [data, setData] = useState([]); useEffect(() => { … setData([1,2,3]);}, []); return ( <Router> <Routes> <Route element={<SomeElement/>}> <Route index exact path="/path1" element={<SomeComponent data={data}/>}/> <Route path="/path2" element={<AnotherComponent data={data}/>}/> </Routes> <Router/>); } I just want to move routes, which are using data to… Read More encapsulating some routes to other component in react-router-dom v6

When i access a react-router route directly via url, it redirects to the '/' route

Advertisements Whenever I access the "/projects" route via url, it redirects to "/", but I can access it via a button for example. I am 100% sure it’s something wrong with the AuthContext, because if I just put true on the condition arg on PrivateRoute component, it works, but if the condition come from the… Read More When i access a react-router route directly via url, it redirects to the '/' route

unable to get categories value from table property using foreign key

Advertisements I want to get the detail property per id from clicking the property list, I have got the property value but can’t retrieve the category values ​​using the foreign key. This is my test.jsx component: import React, { useState, useEffect } from ‘react’; import { axiosInstance } from ‘../config/config.js’; function PropertyList() { const [properties,… Read More unable to get categories value from table property using foreign key

React Router Dom: Why does <Link /> correctly navigates to desired path/page but doesn't update the scrollY position to the top of the new path/page?

Advertisements I have a simple React application that has a Home and Privacy Policy page. When using <Link /> from react-router-dom the current page scrollY position is maintained from path A to path B. My home page has a footer at the bottom of the page. When I scroll to the bottom of the page… Read More React Router Dom: Why does <Link /> correctly navigates to desired path/page but doesn't update the scrollY position to the top of the new path/page?