Questions tagged [react-lifecycle]

313 questions
1
vote
1 answer

How do I implement PayPal in React with different payment options?

I'm trying to grasp how to setup a PayPal method within React properly. I've got three cards with each a different payment amount and cannot figure out how to pass props from my Class to the PayPal Function. All i need is the Cost and Description to…
1
vote
0 answers

Jotai + React: unexpected re-rendering, and unexpected stale state value

I'm making a game that, like most games, has various scenarios that can be triggered from anywhere else in the game. I opted to use Jotai as I found it very easy to use as a global state management tool. Jotai atoms behave a bit like setState and…
1
vote
1 answer

componentWillUnmount method not called when react Component disapears

I have a problem understanding why in some cases componentWillUnmount method is not called even if the component I would expect is unmounted. To be more concrete, this is the example. Let's consider a Parent component with a button and 2 children:…
Picci
  • 16,775
  • 13
  • 70
  • 113
1
vote
2 answers

Displaying fetched data issue : objects not valid as React child / TypeError : undefined

I would like to display data fetched from an api, by using lifecycle methods. I manage to fetch the data (object) and to populate my data in the state (array). But I can't display the values in the return part. The first part of the code that seems…
1
vote
0 answers

React useReducer hook and functional component lifecycle guarantees

I'd like to confirm an assumption I am making about functional components and useReducer. From my understanding useState is useReducer under the covers so I'll use useState in this example to simplify. function Example(){ const [count, setCount] =…
1
vote
1 answer

Why my callback is calling multiple time with redux

I am writing a react application with redux, with avoiding the react-redux, which is technically possible if we manually handle all the dispatched events. Here is the sample code. The index.html
Jayendra Parmar
  • 702
  • 12
  • 30
1
vote
1 answer

Post request using Fetch not working from componentDidMount

I would very much appreciate your help here pls. I am very new at web dev and in using ReactJS. I am trying to create a login page, using email and password as credentials. The issue is, if i put my fetch function in ComponentDidMount I get a 404…
Anad Dana
  • 81
  • 3
  • 10
1
vote
2 answers

Understanding React Lifecycle Hooks

I'm new at React/React Native and I just began working on a company and, thus, working on existing projects. The thing is, I can't understand this Creation Lifecycle Hooks on the begining of this code: export default class ListResult extends…
1
vote
2 answers

on route change in react js call a function

Bellow is the App.js file. when ever I click on any of the nav bar the selected route is rendered. function App() { return (
1
vote
2 answers

How to re-render componenets in react-native?

I am new in react-native development, already spent 2 days for this issue. I am not good in typing but I can explain issue with my source code. Current scenario : Home Screen of app : There is dock icon for docking particular card. After clicking…
ANDY DEVS
  • 21
  • 2
1
vote
3 answers

React setState function not reached thus not working

I was trying to count the completed tasks, and the logic should be right I believe, but seems the this.setState({}) is not responding/reached at all, it's not doing anything to the data 'qtySelected' in the this.state({}) since the console.log('ts')…
Hai Na Zheng
  • 167
  • 3
  • 11
1
vote
0 answers

React & Chartjs: Chart re-rendering on mouseover

My state is changing based on incoming props, which then triggers a rebuild of the chart. However, what seems to be happening is that when I mouseover the chart it reveals old data, or data that's disappeared then reappears. Here's a gif showing the…
crevulus
  • 1,658
  • 12
  • 42
1
vote
1 answer

Assigning typeform to iframe

I made a code editor in reactJS and I'm trying to write the Typeform code so that I'll see the output in the iframe. If I assign the value to the iframe in the render() or in componentDidUpdate() or shouldComponentUpdate() or in any other helping…
1
vote
1 answer

Hidden Input/Textarea value onChange setState in React - without user typing inputs

I need to trigger a function when the value of Hidden input/textArea/TextField changing in React. Not when the user enter values. When dynamically changing the hidden input value trigger a function. import TextField from…
1
vote
0 answers

Call order of the React life cycle componentWillUnmount

I have some questions... why do we have such sequences of the componentWillUnmount? from parent to its children. is it possible to reverse and bubble it? from children to their parent? CodeSandbox import React from "react"; import ReactDOM from…