Questions tagged [react-lifecycle]
313 questions
0
votes
2 answers
prevent re render with hooks
I'm handle a toggle button status which is inside a table.. when request to api fail i need to return an error and the checked status can't change.
Checked is controlled by a specific data from api.. What is happening is, when setErrors the…

Giulia Lage
- 485
- 1
- 5
- 17
0
votes
2 answers
redux props receiving data twice
I am using redux to get the async data and response. In the below component when i post recipe and from server i get response through redux the success modal popup twice. reducer is running only once i have checked eveything, only component has…

devesh
- 111
- 2
- 11
0
votes
0 answers
react: reference function based on condition
I need to call different function based on event and condition.
Let me explain on this example:
export class MyComponent extends React.Component {
constructor(props) {
super(props);
this.state = {
isLoggedIn: true,
…

Martin Fric
- 726
- 2
- 9
- 27
0
votes
4 answers
How middleware in react life cycle works?
I am new in react js. I have started doing a small product with react-redux. I am using saga middle-ware.
What i have done is as under.
This is the component
//all import work
import { activateAuthLayout, onLoad } from…

Tekraj Shrestha
- 1,228
- 3
- 20
- 48
0
votes
4 answers
componentDidUpdate load API infinity times
I'm passing information from Component A from the Component B. After that depending on the props id I'm calling an API and setting the data to states. However, when I called the setState parameter to set the the API loaded data, the API were been…

FR STAR
- 662
- 4
- 24
- 50
0
votes
0 answers
componentDidCatch second parameter not type compatible with function being called from within
I have a standard componentDidCatch in my component, which is typed like below and calls an external Logging library from within:
componentDidCatch(error: Error, info: React.ErrorInfo) {
Logger.logErrorMessage(error.message, info);
…

Afs35mm
- 549
- 2
- 8
- 21
0
votes
0 answers
does the state's changes with multiple this.setState calls are aggregated?
Theoretically, I know that the state's changes in the hook setState are aggregated, i.e if I'll call it multiple times in the same function, the state's changes will be collected, and then the state will be changed only once.
Is this is the case for…

Yoav Abadi
- 403
- 7
- 16
0
votes
1 answer
Access updated state values of child from parent in react
I have one component 'Checkin', which further includes a child component 'CheckinGraph'. Checkin graph component has three states values which initialize to 0 but, on the ComponentDidMount life cycle, their values change from 0 to specific values. I…

Pranay kumar
- 1,983
- 4
- 22
- 51
0
votes
2 answers
React lifecycle methods not trigger, is there some hack behind lifecycle methods?
Today I found something like which I was not expected. This does not happen in Angular or maybe another JS library/framework. But today I was shocked when React lifecycle methods not triggered. Is there some hack behind it. let's see the code.
I…

Sandeep
- 1,461
- 13
- 26
0
votes
1 answer
React 16.11 componentDidMount infinite loop
We have upgraded from react 16.9 to 6.11, and now we have infinite loop when side effect in componentDidMount.
export class DataComponent extends PureComponent {
componentDidMount() {
this.props.setData({id: 'new'});
}
render()…

Maksim Zarechnyi
- 407
- 3
- 16
0
votes
0 answers
componentWillReceiveProps() won't re-trigger with new props are sent
I'm fairly new to react and I am starting to be comfortable with building out my own designs, accessing apis, etc...
I am trying to display errors for a signup page and I am setting a local storage variable thats value is the string that…

Jack A
- 88
- 6
0
votes
1 answer
Reactjs Helmet, GoogleSEO
Does somebody know about a Helmet in ReactJS (https://github.com/nfl/react-helmet). I try to use Helmet for google seo.
My Title

user2301515
- 4,903
- 6
- 30
- 46
0
votes
2 answers
React life-cycle method componentDidMount() not working
I am very new to React and currently working on this hackernews app. I am following the instructions given in the book "the road to learn react" to build this app. However, the react life-cycle method componentDidMount() does not seem to be working…

Nishanth B.S
- 5
- 1
- 3
0
votes
2 answers
Update array of items with help of modal input in React
I didn't find any suitable answer for this question. Here is what I am looking for.
I have lists of menus items coming from the state array variable (https://i.stack.imgur.com/rOWg2.png).
I have an add button which opens a modal. Modal includes an…

Pranay kumar
- 1,983
- 4
- 22
- 51
0
votes
2 answers
React.js, how to render users action instantaneously (before waiting for server propagation)
I'm building a shopping list web app. Items in the list can be toggled 'checked' or 'unchecked'.
My data flow is this: click on item checkbox --> send db update request --> re-render list data with new checkbox states.
If I handle the checkbox…

Cory Crowley
- 304
- 1
- 12