Questions tagged [rerender]

453 questions
2
votes
0 answers

How to prevent re-render of a function component containing a useEffect hook in a test

I am testing using jest and am rendering a mock component that contains a useEffect hook, but upon running my tests I'm receiving the error "Too many re-renders. React limits the number of renders to prevent an infinite loop." How do I go about…
springathing
  • 425
  • 3
  • 8
  • 28
2
votes
1 answer

Why, in React, do children not re-render when parent component re-renders(children are not wrapped by React.memo)?

In this article React Hooks - Understanding Component Re-renders, I learned that when we use useContext Hook in parent component, only the children components which consume the context would re-render. And the article gives two way of consumptions…
TORyTANG
  • 45
  • 1
  • 6
2
votes
1 answer

React select dynamically adding options menu list scroll issue

I'm using react-select and I added a button at the end of the MenuList component in order to load more data. When I click on this button, my state get updated and the options props of Select changes. This re-render properly the new options, however,…
rmonjo
  • 2,675
  • 5
  • 30
  • 37
2
votes
1 answer

Avoid re-render while open/close material-ui Dialog component

I've got some problem with omit re-render while click button which open Dialog component. Currently I use useState flag which toggle my Dialog component but I must avoid re-rendering because there's expensive operations on big data. Anyone know…
Dominic
  • 105
  • 1
  • 4
  • 13
2
votes
1 answer

Child Component doesn't rerender when state of parent component changes

I have the following issue: I have an Component that renders other components in it. One of this component gets state variables of my parent component as parameter and are using them actively, but they don't rerender when the state of the parent…
vazun
  • 194
  • 2
  • 15
2
votes
2 answers

React.js useState hook causes too many re-renders and cant update my state

I am a student trying to get the hang of React. So far I would like to be able to cut my data array that I receive from the API into chunks so that I can use a pagination effect later down the road. I cant figure out why the function arrayChunk()…
rockon_d
  • 1,094
  • 2
  • 8
  • 21
2
votes
3 answers

React limits the number of nested updates to prevent infinite loops

I'm using react js to show locations on map. and get the coords from a json file. I set up a button to select each.then when the coords are selected I have to rerender to display new info I've just got. but I have an error says : Error: Maximum…
Tannaz Shirzadi
  • 81
  • 1
  • 2
  • 4
2
votes
1 answer

Is the rendering of a child component in react different from react native?

First of all, I have a basic level in english. So I hope you understand. Is the rerender of a child component in react native different in react? Let me give you an example: class App extends React.Component{ constructor(props) { …
pedrohpinho
  • 63
  • 1
  • 4
2
votes
2 answers

How to prevent React from re-rendering the whole component when using setInterval

I'm developing an app player. see the picture below: The progress bar must show the current time, but with every tick of setInterval(), my component re-renders everything. That's causing my app to be slow. This is my code: this.state = { …
Enesy
  • 259
  • 3
  • 13
2
votes
1 answer

Automatically refresh a component in Blazor

I am working on a Blazor page for adding a new object. The object "RepairOrder" has List of object "RepairSection". On the page there is an area that will loop through the List "RepairOrder"."RepairSections" and show the elements:
Dwayne Barsotta
  • 103
  • 1
  • 1
  • 7
2
votes
1 answer

h:selectOneMenu labels not changing on a4j rerender

I have an h:selectOneMenu set up that looks something like this:

Header


iandisme
  • 6,346
  • 6
  • 44
  • 63
2
votes
1 answer

React useContext, useRedux child component does not update

React application using hooks i am using React Hooks useContext, and useReducer to mimic Redux However, when Context.Provider value (counter) is updated the child components are not updated. Why does the child component not rerender? Store.js import…
KyrLouca
  • 45
  • 7
2
votes
1 answer

Component not re rendering even after calling the setState

I have a react component in which user can upload Image and he's also shown the preview of uploaded image. He can delete the image by clicking delete button corresponding to Image. I am using react-dropzone for it. Here's the code: class UploadImage…
uneet7
  • 2,925
  • 7
  • 24
  • 41
2
votes
1 answer

React re renders all items in array when new items are added despite using unique keys for all items

Original Post I have a page that renders each item in an array contained in a redux state using Array.prototype.map. The array is initially populated when the componentWillMount() callback is called and is then appended when the user requests more…
elemetrics
  • 330
  • 1
  • 8
2
votes
1 answer

Why isn't the child component updating?

When I change the name of a product, in this case of the first one, I can track the changes from App -> List. However list_item doesn't get its props updated. I thought the problem was that the component is not rerendering but it is. It's the props…
That Guy
  • 154
  • 2
  • 14