Relative Content

Tag Archive for reactjsreact-router-dom

Page refreshing

I am working on a product website with React and each time I click on a particular menu, it refreshes my entire page instead of just rendering component.

React Private Routes

[PrivateRoute] is not a component. All component children of must be a or <React.Fragment>

React Router DOM Scroll Issue with Links and Form Submissions

Could someone help me with this issue? I’m encountering a problem while developing a React project. I’ve created several components, including a header and footer, and linked them using React Router DOM. Now, suppose I scroll to the footer on the homepage and then click on a link to another component, instead of starting from the top, it resumes from where I last scrolled. I attempted to use useEffect to render components afresh upon navigation, but this introduced another issue, submit buttons trigger animations to highlight errors when empty, but they unexpectedly scroll the page to the top upon clicking, which is quite disruptive. Furthermore, I’ve implemented a popup login box that only occupies half the screen, but clicking its login button also causes the page to scroll to the top.

ReactJS: Refresh page navigate user to “/”

Refresh page navigate user to “/”
I have this App.tsx in which if user is not logged in and he is on privacy-policy page then if user refresh the page it directly navigate to index page (“/” route).
and could you guys please help me to reduce the logic ?
thank you in advance !

Refresh page navigate user to “/”

Refresh page navigate user to “/”
I have this App.tsx in which if user is not logged in and he is on privacy-policy page then if user refresh the page it directly navigate to index page (“/” route).
and could you guys please help me to reduce the logic ?
thank you in advance !