Questions tagged [react-lifecycle]
313 questions
1
vote
3 answers
Why the componentDidUpdate is infinitely updated?
I need to drop a picture, then upload it to the server and update the interface. I have a problem, the lifecycle method componentDidUpdate is beginning to be updated infinitely, in the condition I indicated to compare this.state with the prevState.…

Dan Onejump
- 25
- 4
1
vote
3 answers
API call on event in react, componentDidUpdate or eventHandler?
Where should we ideally place an api call to be made on occurrence of an event in React
Inside the eventHandler or componentDidUpdate ?
example:
handleItemClick = (item) => (event) => {
this.setState({selectedItem: item});
…

Rahul Yadav
- 2,627
- 5
- 30
- 52
1
vote
3 answers
alternative for this componentWillMount case?
I'm trying to refactor some old code.
componentWillMount has been deprecated.
How would I refactor it here into something else?
class Detail extends React.Component{
constructor(props) {
super(props);
this.state = {
…

thanks_in_advance
- 2,603
- 6
- 28
- 44
1
vote
1 answer
React: setState is not rendering the page again
I am struggling with React and the lifecycles. I try to implement a very simple Next button which shows the next page with a next set of items. When I change manually the state offset to 3, the page is rendered correctly with the next items. But…

Rogier
- 905
- 1
- 10
- 25
1
vote
4 answers
Why component update lifecycle executes whenever parent's state changes?
I have a parent component called 'App' in which a child component is used called
'NewComp'.I have defined componentDidUpdate() lifecycle inside child component,not
in parent component.
Parent component:
class App extends Component {
state = {
…

ShahEryar Ahmed
- 115
- 1
- 2
- 10
1
vote
1 answer
Uncaught RangeError: Maximum call stack size exceeded - ReactJS
I have gone over all questions like mine, but couldn't find anything useful for this case.
Please help.
This is my function:
renderFields() {
if (this.props.field) { // some prop
return (

dututu
- 41
- 6
1
vote
3 answers
how to prevent children component re render, when state/props parent component changing?
right now im have tree component like this