score:1
you are using react-router-dom@6
. routing/navigation in rrdv6 can use either absolute or relative paths. the difference is a leading "/"
for the path. navigate("./homepage")
is a relative path from the current location.
the following are the same:
navigate("./homepage")
navigate("homepage")
the result is that the user is navigated to a "homepage" relative to the current path.
since "/homepage"
is a root route you should use an absolute path.
navigate("/homepage")
navigate("../homepage")
could also work since you are in the "/login"
route.
score:1
you should pass "/homepage" to navigate
without the .
Source: stackoverflow.com
Related Query
- React Router issue. Whenever login button is clicked. I am directed to a blank page with the homepage link appended to the login page link is made
- React update state only when button is clicked rather than updating whenever something is written in input
- How to get a login button to navigate to a new page once clicked. I have downloaded and used the React router dom
- I've a issue my react login page and router code
- data rendering issue after button is clicked in react
- Issue with submitting the form when the button in search bar is clicked in react
- React js: React router not redirecting when button is being clicked
- How to navigate on path by button click in react router v4?
- How to hide navbar in login page in react router
- Facing issue while adding radio button in react - input is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`
- Redirect to previous path on login - React Router v4
- The redirect_uri issue in LinkedIn Login using React
- React read value of button clicked
- Handle back button with react router
- React router browser back button isn't working
- Use Facebook Login Button with React
- Show loader when button is clicked in react native
- React Router - How to Determine If Back button was hit?
- Redirect to login page in react router 4
- React Router issue within library - using elements outside <Router>
- React Material UI + Router redirect button
- Retrieve which button was clicked in React
- React Router Dom v4 handle browser back button
- React Router redirect rendering a blank screen
- How to center text in Facebook Login Button for React Native (Android)?
- How to add login authentication and session to ReactJS React Router and Redux with MongoDB + NodeJS Express?
- Change State whenever button is clicked back and forth in React?
- Redirecting using React Router shows blank page
- issue with how to render with react router
- How to Show div when a Radio Button is Clicked in React
More Query from same tag
- Good practices for using the same form components for both create and edit pages
- Centralizing actions not working in React/Redux
- Create an instance of a React class from a string
- Array containing objects is duplicating them rather than overwriting their values
- Auth error with POST request: "Authentication credentials were not provided" using Axios, but works using POSTMAN
- Error: Query.get failed: First argument must be an object
- Why authorization token exists in axios interceptors even after deleting the token?
- Webpack fails with babel has been moved to babel-core
- React-Native-Web vs ReactJS
- how to trigger react render on data change
- Code from example, error: Expected ";" but found "class" and more syntax errors
- Get the error of a JSON Validation List in ReactJS
- React store and access data in state
- How to make a stories.mdx file in Storybook?
- Webpack 4 extract css from scss not removing the sass file from complied file
- useEffect called in higher order component
- How to render images with webpack + react?
- Using JOIN and COUNT to find totals SQL
- How to define function in React Component?
- Measure execution time of web worker
- Nginx, Docker and Docker Compose
- How to sort or create a new array by grouping year and data
- A React component's function is not recognized as a function when passed in as a parameter
- Why is the src attribute not showing up when I open up the inspector tool?
- Cancel previous promise.all when onSearch is called again
- Not getting callback after adding an event listener for scroll event in React.js
- ReactJS show modal popup form on specified keystroke
- when using create-react-app dependencies @testing-library could not resolve
- Handle `onClick` event using redux
- How to get the promise state when creating a new Auth user in firebase using javascript