score:4
that's probably happening because your "router component" is trying to re-render everytime something changes (probably the history).
it's easier to use a const for your routes
const browserhistory = userouterhistory(createhistory)({
basename: '/sign',
});
const history = synchistorywithstore(browserhistory, store, {
selectlocationstate: (state) => state.routing,
});
const routes = (<route path="/" component={sign}>
<indexredirect to="/login" />
<route path="login" component={login} />
</route>)
reactdom.render(
<router history={history}>
{routes}
</router>,
yourelement
);
Source: stackoverflow.com
Related Query
- React-Router keeps giving me a warning: You cannot change <Router routes>
- How do you write nested routes after dynamic path in React Router v5.2?
- In my React app hosted by heroku, react browser router can direct exact routes successfully but dynamic routes cannot be found
- You cannot render a <Router> inside another <Router> -- using React Router 6 with Storybook
- How do you change the current path name in real time based on textbox value? react router
- How can I use React Router to change routes from within a component that is also Routed in the Main App.js component?
- Split react router keeps matching 404 route on all routes
- Nested routes with react router v4 / v5
- How to implement authenticated routes in React Router 4?
- react router v^4.0.0 Uncaught TypeError: Cannot read property 'location' of undefined
- How to fetch the new data in response to React Router change with Redux?
- Cannot read property 'history' of undefined (useHistory hook of React Router 5)
- You should not use Route or withRouter() outside a Router when using react-router 4 and styled-component in react
- React router private routes / redirect not working
- React Router v4 routes not working
- Accessing Redux Store from routes set up via React Router
- React router - Nested routes not working
- React Router v4 nested routes props.children
- Passing props to React Router children routes
- React router modal-only routes
- How to nest routes in React Router v4?
- React Router v4 renders multiple routes
- React Router Error - Cannot GET [Page Name]
- React router change url without page reload
- React router v4 - How do you access the state that is passed via Redirect?
- Router link giving warning " link is a void element tag and must not have `children` or use `props.dangerouslySetInnerHTML`."
- How do you change the Stepper color on React Material UI?
- React router Link not causing component to update within nested routes
- Lazy loaded React router routes loading anyway
- React hook form v7 Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()
More Query from same tag
- Mutating the DOM in React
- Update props of specific component
- Weird behavior in react hooks useEffect and ref object
- How do i reset a useref to null in react
- React Router: navigate to /compose/tweet but keep orthogonal previous route (like: /notifications) mounted
- Cannot read property 'setState' of undefined when using setState inside function()
- React Multiselect checkbox filtering data
- When click on item can't do this.setState REACT
- Why won't my React accordion animation work?
- Accessing new state in current handler
- using antd with redux-form
- Await for changing state of redux store
- How to query for a list of results using geocoder API from Google?
- How to test the state of a functional component in React with Jest (No Enzyme)
- React Router how to return 404 page in case of dynamic routes expecting a parameter?
- How to fix "Type '{}' is missing in the following properties..." error in Typescript?
- Is there a way to take a code which is defined inside render , out from render function in React?
- How to specify a key for React children when mapping over an array
- Javascript object elements is undefined
- Routes rerender if I use a map instead of static components
- Click handler on mapboxGL not respondig to updated state using react hooks with typescript
- I'm not Getting any number of calls in my React Test using React Testing Library
- Gatsby client routes go to 404 in develoment environment
- Single-SPA localhost CROS origin Issue- React Application
- React Scroll to another page Not working react-scroll
- creating a modal with a button, React, Material UI
- Counting vowels in a string with React hooks
- Loading and pre-filling form from button on separate component
- Object of objects JSON response from Django backend to React-Redux frontend
- Difference between <React.Fragment> vs <>