score:2
Accepted answer
you are probably facing the problem react router have with update blocking. this happens because redux avoids re-renders and call mapstatetoprops, instead.
to prevent this behavior your can pass the option pure: false
in react-redux connect function.
example:
connect(mapstatetoprops, null, null, { pure: false })(component);
you can head to react redux api documentation to see more details on this option.
score:0
as an alternate you can use withrouter
import { withrouter } from 'react-router-dom';
.
.
export default withrouter(connect(mapstatetoprops)(approutes));
references-
Source: stackoverflow.com
Related Query
- Render method returns null in react router v4
- Jest Enzyme test a React component that returns null in render method
- React router 4: How to wait for a promise to resolve, inside render method of Route?
- React router render method with HOC
- React router v4 render method refactor
- Props values in react router render method are not updated with Firebase firestore onsnapshot realtime update
- How to call a function method in a component class render method? getting Uncaught TypeError: Cannot read property 'value' of null in React
- Render method not getting called in react router
- Rendering React components with promises inside the render method
- react router difference between component and render
- For loop in react render method
- React component children detect if empty / null before render
- React Router 4 Match returns undefined
- Render multiple components in React Router
- How to pass the match when using render in Route component from react router (v4)
- React - How to iterate over dictionary in render method using JSX?
- Can not pass state with react router dom v6 beta, state is null
- Calling setState() in React from render method
- Early returns in React sub render function: return null, [], or React.Fragment?
- Reactjs Warning: input is a void element tag and must not have `children` or use `props.dangerouslySetInnerHTML`. Check the render method of null
- React Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `App`
- How to provide dynamic className to element in React Class render method
- Render async component in React Router v4
- How to prevent NavBar Menu to re render when navigating? React Router v4
- Render multiple elements in React Router v6.+
- If component returns null in its render function, why componentDidMount is triggered?
- Enzyme returns null for prop on shallow rendered react component
- Flow error with react render method
- onEnter Transitions with React Router and Redux Simple Router Dont Render New Route's Component
- React ambiguous error messaging: "Check the render method of `Constructor`."
More Query from same tag
- antd Select Option not rendering when entering text in React Hooks
- React app routing doesn't load content unless page reloaded
- Yarn Install failes
- How do I pause the animation in React Spring?
- React too many re-renders when create an array with UseState
- Plugin "react" was conflicted between "package.json ..." and "BaseConfig ..."
- How to render JSON in React
- How to extract multiple theme stylesheets with webpack?
- Apollo Client readFragment with custom id (keyFields)
- Fetching listgroup from server in react
- useReducer of React is async
- Understanding documentation of React with redux
- Not counting DOM elements in React site with Cypress?
- TypeScript: How to access onChange event data without error? (Object is possibly 'null')
- How to access callback through function call
- Unable to obtain correct parameter for React JSX action
- Force Navigate To Login Screen on Refresh React Router Dom
- onClick "save image as" in React
- Testing with Jest failed with Error: Error watching file for changes: EMFILE
- POST 404 Not Found caused by bad routing?
- Axios baseURL is not appending with the URL in react.js
- React, two components running two timeouts to dismount; same unmount gets called twice
- How can I render an array of objects?
- Jest error '' TypeError: Cannot read property 'preventDefault' of undefined "
- Map is not a function in arrays inside Objects React
- Why am I getting the error message "Property 'then' does not exist on type 'AsyncThunkAction'"?
- export javascript function using React
- How can I dispatch from child components in React Redux?
- What is the best practices for redirecting users in React applications?
- Nested onHover selector not working with styled-components