Questions tagged [rerender]
453 questions
1
vote
2 answers
why component re-render again even with useCallback?
I have a User Page that fetch the user info with a custom hook useFetchUserId().
This custom hook uses useEffect to fetch the data, and has a console.log that is printed every time I switch between tabs, even if I use the useCallback hook. Can you…

Giovanni
- 512
- 2
- 6
- 23
1
vote
0 answers
Why does my ReactJS component re-renders even if it's exported with React.memo?
I have a ReactJS application. The component is wrapped with a component, because I need to have its state shared among components that only have as a common ancestor, since it is the component that mounts…

Ale TheFe
- 1,540
- 15
- 43
1
vote
1 answer
How to stop the rerender in videojs when the state update in react
I get the code from https://videojs.com/guides/react/.
If I update the state, my video rerender and the video start playing from first, how to solve.
Example code:
Videojs code:
import React from 'react';
import videojs from 'video.js';
import…

Venkatesh
- 58
- 8
1
vote
1 answer
render a variable foreach in react
On React (Next.js), I am trying to make a counter for adding records to the PostgreSQL database (>30,000 records) (for import from EXELL). The addition procedure works quite quickly, but I still want to make a counter that would be displayed when…

Роман
- 71
- 1
- 3
1
vote
1 answer
React context rerendering causing duplicate datalayer pushes
I am using React context to pass data through a particular journey in my app, and I have come to find that at the last step where I am rendering to the DOM and I want to perform a specific function within my useEffect (it makes data layer push) that…

physicsboy
- 5,656
- 17
- 70
- 119
1
vote
0 answers
React rerendersa all inputs on one input state change, killing all performance and making experience laggy
I'm developing some selected products manager and encountered a problem i can't think of solution by myself. I have main state with all the data from api. It looks like array of
{
"img_url":…

Alan
- 91
- 1
- 6
1
vote
1 answer
how to use useState like this? what does it mean?
Can anyone please explain me what const rerender = React.useState(0)[1] is this?
import React from 'react'
import axios from 'axios'
import {
useQuery,
useQueryClient,
QueryClient,
QueryClientProvider,
} from "@tanstack/react-query"
import {…

Vijay Sai
- 15
- 4
1
vote
1 answer
What will happen to the current function call when a re-render happens due to a state update?
I know when I set a new state by using the react hook setState the page will re-render at some point. When using react funtional components the whole component gets re-rendered.
To be more specific about my question the code below shows an example…

JackFrost
- 83
- 1
- 9
1
vote
1 answer
Vue: All components rerender upon unrelated data property change only if a prop comes from a method that returns an object or array
(Vue 3, options API)
The problem: Components rerender when they shouldn't.
The situation:
Components are called with a prop whose value comes from a method.
The method cannot be replaced with a computed property because we must make operations on…

daniel p
- 741
- 7
- 12
1
vote
0 answers
React JS - Using Date.now() to change the state and rerender a component is unreliable
I'm working on a personal project.
I have a simple system that for now is just the CRUD operations. I have a parent component that fetches a list of objects using axios.get. This component passes the list of objects to several children that display…

Mefistofeles
- 21
- 4
1
vote
1 answer
Why my functional component doesn't re-render when change state? (react)
I'm stuck in project because my functional component do not re-render when I update this state.
const OneProduct = (props) => {
return (
1
vote
1 answer
How can I re-render stats with a function and redux (for re-render likes)?
I saw a lot of docs about stats but I can't find a way to re-render my stats (I'm using redux but I saw this is nothing to do in reducer or action).
I only use a function onClick (for likes true or false) and other function to show the results with…

Elodie Jean
- 11
- 1
- 5
1
vote
0 answers
How to render react components after the data is fetched from the server
I want to render the home component according to the data passed into currentUser state. But as getCurrentUser() function is asynchronous, all the react components renders before the data is fetched and stored into currentUser state. As the…

UHpi
- 93
- 1
- 6
1
vote
1 answer
Cypress Select Dropdown Doesn't Rerender Dependent Dropdown
I have a dropdown that onChange sets the options for a second dropdown.
The first dropdown triggers a setState which triggers a useEffect that filters existing data into a list that is mapped into the second dropdown.
This works great in the…

A. Luca
- 43
- 5
1
vote
1 answer
React re-render does not work. img src does not load
the code below is supposed to download 5 urls from firebase and when it is already downloaded, it passes 1 url to "currentUrl" state. after that url should be passed to
below and img should load. the problem is, img does not load... .…

Jakub Godlewski
- 33
- 3