score:1
Accepted answer
you forgot to wrap your component using withrouter
export default withrouter(login);
note: in your post you write this
route path="/login" render={() => login } exact
which is wrong (unless it is a typo), it should be,
<route path="/login" render={() => <login /> } exact />
score:0
the thing that's undefined is most likely "this.props.location". did you remember to wrap the component in "withrouter"? if not, you won't have access to it.
Source: stackoverflow.com
Related Query
- React router 4 custom component giving render function error
- React Router render vs component giving me error
- react router difference between component and render
- Unexpected token < error in react router component
- How to pass the match when using render in Route component from react router (v4)
- Render async component in React Router v4
- Using CSSTransitionGroup on a react component is giving error
- onEnter Transitions with React Router and Redux Simple Router Dont Render New Route's Component
- React router v4 render component inside element
- React component function returning JSX causes error when used in render method of ES6 class React component
- React router dom redirect problem. Changes url, does not render component
- React Router does not render Component
- react router doesn't render component
- React Router master-detail: children component don't render new view until page refresh
- React router render component on same page
- How to 1). put a div , 2). render a component without Route inside <Routes> with React Router in v6 React?
- Why React still render the child component with Error Boundary
- Programmatically navigating : React Router V4+ Typescript giving error
- React router v4.2.2: using a string instead of function inside component prop of Route results in error
- How to use React Router to replace a Component in render method?
- Render Same Component With Multiple Paths React Router Dom
- Router events cause an error while being used on the constructor Warning: Can't perform a React state update on an unmounted component
- Nested React Router Component Won't Render on New Page
- React Router will not render Route component unless page is refreshed
- Dont render Search component with Router React js
- React router dom changes url, does not render component
- How can I get a component to render as a parent of protected routes in react router dom?
- Trying to render Firestore information in React component - utilization of useRef() not re-rendering and useState() raises error
- react render error ReactDOM.render(): Invalid component element
- Getting Expected an assignment or function call and instead saw an expression no-unused-expressions error when trying to render a component in React
More Query from same tag
- how to tell react-router to wait until something has happened?
- Getting ReactTransitionGroup and Redux-Simple-Router to work together
- How to add multiple checkboxes to a state
- Make sure Axios/Fetch call runs for at least X Seconds in Javascript
- How to use REST API data with moment isBetween to update open/closing times
- Log setState calls
- In React 17 jquery issue?
- Reactjs converting a csv file in local to json
- jest function mocked from module doesn't detect its call when it is called by other method
- Toggle button work but don't show list content in React
- React component for radio button
- Laravel and variable naming conventions (snake case + camel case)
- How to display state on page in jsx?
- How to initialize Cloud Firestore Bean to use throughout all packages?
- How to add a loader to http interceptor
- HTTP GET response 304 status error after deploying react app on netlify
- How to scroll to an element on a page which has a fixed header when clicked on a table row?
- Typescript + webpack (with hot reload) + NodeJS
- Data table not displaying
- how to send data in GET request header using react and axios to Django rest framework?
- Vite.js + React: Maximum call stack size exceeded
- TypeError: Cannot read property 'handleClick' of undefined React JS
- Exported plain component is still expecting a store during test
- How do use a piece of state in two different components?
- Emitting custom event in React
- symbol or html entities code did not complied in jsx
- I can render my page just once. After refreshing the page, i am getting an error as cant find data from api. Please let me know my mistake
- Need an appropriate loader to handle image file
- Multiple images have uploaded but not showing in UI (React Js)
- Redux mapStateToProps returns undefined