score:0
i fixed this with a mixture of componentdidmount and componentwillreceiveprops to figure out if the new route is hit and the redux selectbook is set or not. seems to be working now without constant refresh.
score:1
most likely it is because you are binding it in render. this will create not only multiple instances of function objects in runtime, every time render is called for outer function. if button is a pure component which it should most likely be, every time the button is re-rendered it will create a new function object reference for onclick and since buttons prop is changing because it's reference is it will re-render
onclick={this.handledelete.bind(this, item)} //bad practice
do below instead, this will make sure all the onclick refer to one function object reference which is bound in constructor and hence making your component more performant.
constructor(){
this.handledelete= this.handledelete.bind(this)
}
//bind it once use every where
onclick={this.handledelete}
and remove binds in onclicks.
Source: stackoverflow.com
Related Query
- Presentational Component continuously rerenders
- Nesting a container component in a presentational component
- Dynamic Opacity not changing when component rerenders in react native
- React SVG disappearing when component rerenders
- React PDF viewer component rerenders constantly
- Redux Presentational Components Vs Container Component
- Component rerenders when state has not changed on the second click
- React rerenders whole component when its properties change
- Preventing setState rerenders entire functional component
- Higher order component always rerenders ignoring shouldComponentUpdate
- Is it an anti-pattern to have a presentational component inside another presentational component?
- React function component setTimeout - Multiple render calls and rerenders (recommended approach) (fires multiple times)
- Element created in constructor not updated when component rerenders
- React component to draw video frames continuously to canvas: doesn't work on iOS
- ReactJS component always rerenders with external library
- React component continuously updating
- Redux. Describe presentational component's lifecycle methods from a container component
- Angular 6: continuously execute http request inside ngAfterContentChecked after receive data from parent component
- React setState on array of objects rerenders every component
- React memoized component rerenders without props change
- Component in wrapPageElement rerenders – GatsbyJS
- React useState - setValue rerenders the component even though the value is the same
- How to stop rerendering of child component when parent rerenders
- React presentational component unable to read value for <input /> from redux store using react container
- Passing actions to child presentational component/accessing Route Params from child container component (ownProps)
- The if statement inside the return statement of my presentational component is throwing an unexpected token error
- React useCallback with onClick not working. Rerenders child component
- Why I cannot type continuously in react Input field when passing values to another component using props
- Get Redux Store In Presentational Component
- Is passing an event from a presentational to container component an anti-pattern when using Redux?
More Query from same tag
- React - Form keeps re-rendering component while I type
- JsPDF - Image cut on little screen
- storing user uid instead of refresh token to keep user signed in?
- map function doesn't work in React component
- How can I mock out all the icons in React `@material-ui/icons` using Jest?
- Reactjs doesn't immediately update the assigned value when useState is used
- Is there a way not to re-render some part of a React state?
- Cannot GET /path using ReactJS, webpack, express
- React | Dynamic select get values
- Retrieve params and set params as argument in fetch request within useEffect Hook
- Redux: API data response sorted on click
- Cannot send email with EmailJS/React
- Saga for constant
- Action cable, ReactJS update fails Capybara spec
- Mapping data from array in child component and parent component
- How to change format from string date to utc
- another alternative to following approach without updating internal state
- How can I display item in ToDo List
- How do you style a component to be under another component?
- Function is not being called as it should in React onClick()
- mocha+chai+jsdom-Can't load custom modules Directories
- Convert array of links into links - React
- Change color of range column chart in ApexCharts
- React Convert class component to Functional component not working
- Funtions with two parameter not working in React
- d3 line chart data point is cropped from min and max domain values
- Material UI - Facing an issue that drop down options are coming below the modal window footer
- Best way to pass images in static react app
- Errors with authentication in a Modal using bootstrap and Firebase
- How do I prevent user from entering a username that starts with a number, but allow numbers only after alpha characters?