Questions tagged [react-component-unmount]

40 questions
1
vote
2 answers

How to use componentWillUnmount()?

I am new using React-Native and I'm creating a music player for a streaming app and almost everything works fine, it plays in the background but when I want to switch to another album or playlist it does not cut the song that is playing to play the…
1
vote
1 answer

How do I clear out an Image.getSize request when unmounting a React Native component?

I have a React Native component that makes an Image.getSize request for each image in the component. Then within the callback of the Image.getSize requests, I set some state for my component. That all works fine, but the problem is that it's…
0
votes
1 answer

expo-barcode-scanner - After closing the app the camera symbol stays in the right corner

I'm trying to make a qr code scanner with the expo-barcode-scanner in react native. Everything works fine but when I exit the application (It still run in the background), the camera symbol in the top right corner stays there like this: I just…
0
votes
0 answers

componentWillUnmount and setState to open Dialog to confirm a save of data

I currently have a componentWillUnmount used specifically to check if a user wants to save their data, if it has not been saved already. I created a custom prompt using Material UI's dialog, which is opened via a state change. Before I was simply…
Vlad SD
  • 169
  • 1
  • 1
  • 11
0
votes
1 answer

how to finish modal animation in react-native-modal componentwillunmount?

I am looking for a solution to delay RN component unmount until react-native-modal animationOut is completed. This animation is triggered by setting isVisible=false. With my current implementation the animation performs as expected on…
0
votes
0 answers

React: Can't perform a React state update on an unmounted component. Sharing state between 2 components and updating it withing each other's component

I am a newbie in react and developing applications using react js (front) and express (API backend). Let say I have an organization table fetched over through API. The state network storing the fetched response is shared by both components…
0
votes
1 answer

REACT : How to render component inside a div with specific classname?

I'm not sure what is the best method to do this but - I have outputted list of divs. When I click on one of them, it gets given a class active. I need to show a component I made (to render) inside this particular class once the div has been clicked…
0
votes
1 answer

Expo Audio: "update on an unmounted component" even using useEffect() cleanup function

Expo documentation states that the Audio.Sound component should be unmounted by an useEffect-hook returning the cleanup function. const [sound] = useState(new Audio.Sound()); React.useEffect(() => { return sound ? () => { …
Niklas Dada
  • 311
  • 4
  • 17
0
votes
0 answers

React keep state alive for remount

I want to know if there is another propper solution for the problem I have. I want the state of a component to be kept alive when React remounts it to a different parent node. I am working with an array of components which is splitted into different…
0
votes
1 answer

How can I fix the following warning: "Can't perform a React state update on an unmounted component"

Edit: I have been trying to implement a similar fix as this in my code, but I am very confused about how this method would translate in my code. I have been trying to apply that fix to my updateDose function, but it isn't working. I am creating an…
0
votes
1 answer

React form submit and "can't perform state update on an unmounted component"?

Basically, I have a login page, and when you fill out the form and submit data, it goes through this const formSubmitHandler = (e) => { e.preventDefault(); //validation and other uninteresting stuff... axios.post('/signin', { email:…
Colt83
  • 139
  • 1
  • 7
0
votes
0 answers

Unsure how to fix React state update on unmounted component issue

I'm building a puzzle application that when completed, will play a video. When I complete the puzzle, everything changes and it works fine but I get the following error in the console and I'm not sure what I need to do to fix it. Can't perform a…
0
votes
1 answer

ReactJS does not re-loads my updated component when separate links are clicked from the navbar

I have this case where, in the nav bar I have different categories eg Science, business etc. When clicked on ay of these we are supposed to render News component with the appropriate category. But in my case on clicking on any of the link, although…
0
votes
1 answer

React functional component un-mounts/mounts the parent component after setting state

I have a simple functional component which toggles the password field to and from visible via a small button which changes between closed and opened eye images. There is no state affected in the parent, however, the parent un-mounts and re-mounts a…
0
votes
0 answers

ReactJS: How to use useState in a subcomponent of the page?

I'm trying to use useState in the form but I get the following error: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and…
Gonsa02
  • 333
  • 3
  • 13