Questions tagged [rerender]

453 questions
4
votes
1 answer

React: setState is not causing a re-render?

I am new to React, JS, JSX. It doesn't appear that setNewWeather is updating the weather state properly, as in, it's defined by the initial value, but then changes to undefined. Because if it updates, it should cause the re-render; I have looked at…
studstill
  • 65
  • 1
  • 10
4
votes
2 answers

Prevent FlatList re-rendering causing performance problems

I'm building a React Native App using Hooks and ES6. The Home screen fetches some data from API and display it as image galleries. The Home screen is the parent component which includes a slideshow gallery and a Flatlist as children. 1) Slideshow -…
4
votes
1 answer

React form loses focus on update

I am working on a form that has, among other fields, calendar entries - dates and times. The code is below: {dates.map((d, i) => (
Igor Shmukler
  • 1,742
  • 3
  • 15
  • 48
4
votes
1 answer

React: How to prevent re-rendering child components in `map`?

I tried to boil down the problem into an example as simple as possible: We have a list of child components, each called NumChoice, each representing a number. NumChoice is wrapped in React.memo. In the parent component, we have an array of booleans,…
1man
  • 5,216
  • 7
  • 42
  • 56
4
votes
1 answer

Expensive function blocks render() update

In my (class) component I want to show Loading spinner for the duration of the _expensiveFunction. Value isLoading was changed in the state before the function was executed, but it will not be re-rendered (spinner does not spin) until…
john_per
  • 320
  • 6
  • 16
4
votes
3 answers

angular 7 - reload data in data table

I'm using angular 7 with angular-datatables. I'm tring to define a "rerender" button in order to reload data like in this example. I don't understand what should I place in the render function: My API function: fn_getFavoriteTables() { …
Assaf Sela
  • 76
  • 1
  • 7
4
votes
2 answers

React Native: Cant rerender Image after state change

I am starting with react-native. I am requesting a gif from the giphy API and then updating my giphyUrl in state (the state is changed) but the gif doesnt change ( the component is not rerendered). class QuoteList extends Component { state = {…
David Geismar
  • 3,152
  • 6
  • 41
  • 80
3
votes
1 answer

Prevent child re-rendering in React.js

How can I prevent re-rendering of child components in React? Everytime an ID saved in useState is updated at the parent level, the child gets rerendered and loses the selection. Here is some sample code for the setup: Parent component: import React,…
3
votes
0 answers

Is using inline functions in react still a performance trouble?

I've been using React libraries like MUI for quite a while now. Every time I go through their documentation I see that in almost every place they're defining a separate function even performing a very simple single code of state update. A quick…
3
votes
4 answers

How can I delete an item from list without re-rendering undeleted Items?

Thank you for all your comments and helpful remarks. following your advices, please find below a code sandbox link https://codesandbox.io/s/magical-butterfly-uk0fjq?file=/src/item.js which may help you figure out the issue. Everything is obvious in…
FJTAIL
  • 107
  • 9
3
votes
3 answers

React: updating one item of the list (setState) instead of all

I have the following code. When changing the value of one element, the entire list is re-render. How can it be avoided by redrawing only one element? I use setState and class components. import React from "react"; import "./styles.css"; class…
Schekhovtsov
  • 101
  • 2
  • 10
3
votes
2 answers

How to avoid unnecessary re-render of a component in React?

I have this case: const Parent = () => { const [value, setValue] = useState(''); return <> } but every time setValue of Child2 is getting called, Child2 re-renders…
entropyfeverone
  • 1,052
  • 2
  • 8
  • 20
3
votes
3 answers

Why my pages are not refreshing with bottom navigation in flutter?

I am working with bottom navigation bar in flutter. I want to refresh every tab when tabs are switched. First I tried to reuse one stateless widget for all the tabs. But it is rerendering pages. My code is as follows: class _CreateOrderState extends…
3
votes
1 answer

Rerender only specific Child Components in JSX map function

I am mapping through an array, which returns JSX Components for each of the items in the array. During runtime I want to pass down values. If they match the value of the individual items, their individual component gets modified. I am trying to find…
Tobi
  • 363
  • 5
  • 15
3
votes
1 answer

Recoil JS - getting rid of the suspense re-rendering my app

I am experimenting with Recoil in a React framework I am currently building. In my use case, the application will produce an action object based on user activities, and then it will send it to the server, from where it will get the application…
Ivaylo Slavov
  • 8,839
  • 12
  • 65
  • 108
1 2
3
30 31