score:1
if the "state" you're after is already in react router, then copying it to your own state is unnecessary duplication, and the cause of your error (trying to update the state during render
. you're better off just grabbing the state from the react router. you can use a route without a path for that
<route render={({ location }) => (
// this will render whenever the location changes
<yournavigationbar location={location} />
)}
/>
score:0
you use a setstate in react lifecycle. you call your method updateactivepath in render or other lifecycle method react. this trigger an extra rendering for your component.
for fix this warning change your setstate location in componentwillmount method or in function call by action (click, ...).
for must information go to lifecycle component documentation: https://reactjs.org/docs/react-component.html
Source: stackoverflow.com
Related Query
- Cannot update state from render method React
- React: update component's props from outside of render method without using state
- State from react useState is updated when key property is used but requires useEffect or similar method to update otherwise
- The state changed but the render method from react does not trigger
- I am using useReducer hook to for making the custom react hook but below in my code i cannot update state which im receiving from the dispatcher funnc
- React js setting the state of a parent component from child Render method
- React Warning: Cannot update a component from inside the function body of a different component
- Update component state from outside React (on server response)
- What is correct lifecycle method in React 16.3 to update canvas from props?
- How to update the state of a sibling component from another sibling or imported component in REACT
- Calling setState() in React from render method
- React Apollo: Dynamically update GraphQL query from Component state
- Update React Hooks State During Render Using useMemo
- Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state. in Index.js
- React update state in parent from child components
- Update a react state (array of objects) from a child component
- React Native: How to stop map markers from re-rendering on every state update
- Cannot update during an existing state transition error in React
- Access a React component method / state from outside the component
- React Native / Redux - setState - Cannot update during an existing state transition
- React: Asynchronous call to update state before final render method is called
- How to update parent state from child component in React + send a paramater
- Too many re-renders. React limits the number of renders to prevent an infinite loop. Updating state of a functional component inside the render method
- Can't perform a React state update on an unmounted component with fetch POST method
- React - Can you update an Unstated container state from an external function?
- Reuse everything from a React component except its render method
- How to update React UI from with state in Redux store with useEffect
- ReactJS: Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state
- React Redux update state from dumb child
- Update ui from props in react js. Props to state handoff in react
More Query from same tag
- Actions must be plain objects. Use custom middleware for async actions. react-redux
- Receiving 'Error: Cannot find module' using browserify, gulp, react.js
- How can i hide long description and making it toggle in react js?
- How can I run the code even when API fails
- Context API, Cannot retreive the data I am setting in seperate component
- How to handler onClick on child component in parent component
- ReactJS - create chunks automatically with lazy loading
- React update state after updating a different one in useEffect
- React Routing 404 error on IIS when you hit refresh
- animate (fadeIn) img src if loaded react #noJQuery
- How to align react component side-by-side
- Child component changing parent component state
- How to make React-Material UI data grid to render rows using alternate shades?
- React redirect to another page with the Enter key without refreshing the page
- React - Getting "Component definition is missing display name" error when using React.memo
- getting array of objects(nested) from api, looping 3x times , opinion, reactjs
- ReferenceError: Cannot access 'players' before initialization
- React js, add event listener on scroll not working. Help me to solve it
- How to define interfaces in TypeScript to pass the props correctly?
- Scoping 'this' within a reactjs component
- How to get data from table row click using Semantic's React Table Component
- React using LocalStorage to show or hide elements
- Promise inside Array.map or loop alternative?
- React enzyme test
- How can CKEditor be used with React.js in a way that allows React to recognize it?
- General 400/500 error handling in reactjs
- Mongoose does not send the updated result
- How to avoid hash sign in URL, using react-router-dom and react-router-bootstrap?
- redux-form, change fields value without changing dirty state
- Import vanilla ES6 extended class into React