Questions tagged [rerender]

453 questions
8
votes
1 answer

How to detect rerenders in React JS correctly?

Let's say we have a parent component and multiple functional child components. I want to clearly know if the parent re-renders does the child re-renders or not. After going through a few articles I came to know there are 3 ways we can detect…
Deepak Kumar Padhy
  • 4,128
  • 6
  • 43
  • 79
8
votes
3 answers

React re render array whereas item key has not changed

Very basic code sample of a list: class List extends React.Component { render() { const listComponent = this.props.numbers.map((number) => , ); return ( …
vital
  • 1,308
  • 3
  • 13
  • 28
7
votes
6 answers

React Native - React Navigation rerender panel on goBack()

I am using React Navigation in my app. How can I refresh the data on my previous panel when going back to it? A practical example would be: I am currently in Panel A, I navigate to Panel B where I update data in my database which is displayed in…
GIV
  • 405
  • 3
  • 9
  • 16
6
votes
1 answer

React.PureComponent and childs

Someone please explain me this last paragraph of the React documentation with a simple example, it's about React.PureComponent , all the examples I've seen are advanced and I'm just starting to know this concept and I can't see exactly what it…
user18944870
6
votes
2 answers

React: Under what conditions does setState from the useState hook cause a re-render?

I have the following code (CodeSandbox): function App() { const [blah, setBlah] = useState(true); console.log('BLAH', blah); setBlah(true); return ; } I understand that setBlah(true) at…
Vampiro
  • 103
  • 7
5
votes
2 answers

ReactDOM.render is no longer supported in React 18

Im using rerender and renderHook in react testing library. Recently upgraded react version to 18. Got below error in one of the test case. console.error Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you…
John
  • 2,035
  • 13
  • 35
  • 44
5
votes
1 answer

How to render only the concerned component with a custom hook and useContext

I'm trying to create a custom hook useFocus based on useContext to set the focus only on the component i select. Its working but other components are rendering even i used useCallback for the function returned by my useFocus custom hook. i would…
5
votes
1 answer

How to force Vue to destroy and re-create the component on route change?

My routes in Vue router: { path: 'articles/create', component: () => import('Detail.vue') }, { path: 'articles/:id/edit', component: () => import('Detail.vue') }, As you can see, I render the same Vue component Detail.vue on both routes. How do I…
mspiderv
  • 509
  • 7
  • 15
5
votes
1 answer

React hooks check what state change caused re-render

Now with hooks, I've got the component's state split into more miniature states. This seemed better until I wanted to find out what state change caused a specific re-render. How can one easily find out what state change caused a specific re-render?
ZenVentzi
  • 3,945
  • 3
  • 33
  • 48
5
votes
1 answer

a4j:commandButton reRendering rich:datatable

My issue is that I am trying to have a column in my datatable show an outputtext by default, and replace that with an inputtext when the commandbutton is pressed. Have not found a solution. First post by the way. I have an a4j:commandButton that I…
TaylorSmolik
  • 116
  • 3
  • 13
4
votes
1 answer

Component rerendering when non-related parts of redux store update in react-redux

I notice that some of my components are rerendering when I wouldn't expect them to. Lets say I have a
component.
calls useSelector, and grabs a slice of state. As an example, my whole redux store may look like this: { …
Seth Lutske
  • 9,154
  • 5
  • 29
  • 78
4
votes
1 answer

reRender a specific row of rich:dataTable

Good Morning! Is it possible to reRender only 1 specific row of rich:dataTable? I have a rich:dataTable and, when I do something that I´m sure only 1 row has changed, I need to reRednder only this row, not the entire table. Is it possible?…
ganzux
  • 874
  • 3
  • 15
  • 35
4
votes
2 answers

how to auto refresh component when redux state get updated

I currently store user name in redux store and show it in topbar after user logged in. (Shown in screenshots). However, it do not re-render automatically when redux state gets updated. I still need to do some actions in topbar then username does…
congying pan
  • 999
  • 1
  • 7
  • 10
4
votes
1 answer

Why does a function outside useEffect get called while a function inside useEffect without dependency array doesn't?

Until today I thought that code inside an useEffect without dependency array and code outside useEffect both trigger on every rerender, but then I found this weird case and I don't understand why is this happening. In THIS example, the first time…
BraisC
  • 199
  • 2
  • 10
4
votes
2 answers

How to stop re-rendering a whole list of items when only one item of the list is created or updated in ReactJs React-Redux?

I am making this web applications which has posts where users can put answers to those posts. I have used React-Redux to manage the state of the application. Every time I create or update an answer of a particular post the whole list of answers…
1
2
3
30 31