Skip to main content
Filter by
Sorted by
Tagged with
1 vote
2 answers
2k views

I'm experiencing a challenge with React Hook Form where my child component InputX re-renders every time there's an update in the parent component or other parts of the application, despite no changes ...
Mustafa's user avatar
  • 979
4 votes
2 answers
6k views

I want to show a toast when my client side component mounts. I'm using sonner library to show toast, it's working fine when we use button to show toast. I make an example app to show the problem. Here ...
saifi33's user avatar
  • 41
-1 votes
2 answers
100 views

I am relatively new to React, and still have not full familiarity with this thing to re-render components every time a state changes. I understand that re-renders make declarative components possible, ...
Nillus's user avatar
  • 1,219
0 votes
1 answer
52 views

I am rendering a series of Doughtnut charts with center text rendered via plugin. While initial render is working as expected, when I implement a client side search and hence re-render the series of ...
Rajkumar Somasundaram's user avatar
3 votes
1 answer
1k views

I am working on updating react version to 18.2 from 16.8.6 in one of my projects. After doing the upgrade one of the major warnings that I got in console is regarding the deprecated lifecycle methods ...
rahulkrishnan's user avatar
0 votes
1 answer
72 views

I have a below parent component where I am updating id value to 2 which is a state of parent component and I am rendering the Child component only if id value equals to 1, if I do so Child component ...
saran0798's user avatar
0 votes
2 answers
50 views

import React, { useState, useEffect } from 'react'; const WindowSize = () => { // Add your state and useEffect logic here const [windowWidth, setWindowWidth] = useState(window.innerWidth); ...
user9042204's user avatar
0 votes
1 answer
39 views

Following is the doc I am using to learn React Custom Hooks. Doc Link - https://react.dev/learn/reusing-logic-with-custom-hooks#when-to-use-custom-hooks In that page, there is a piece of code - ...
Nesh's user avatar
  • 2,611
2 votes
1 answer
2k views

My problem The code is simple. When you switch to any new button, it will log the updated sourceType, then "My Log". You start off at the posts tab, then you clicked users tab, it will log &...
free-stack's user avatar
2 votes
1 answer
224 views

If I have a component: function MyComponent() { const state = useState(resetState()) return jsx(state) } then I can trigger a state reset by passing a key to MyComponent: <div> <...
bebbi's user avatar
  • 2,559
-2 votes
1 answer
284 views

When a particular custom React component I have first mounts, it uses useEffect to kick off a long multistep process of loading data that it will then render. The component isn't always rendered, so ...
WBT's user avatar
  • 2,562
0 votes
1 answer
58 views

In my React Native component, I added an empty shouldComponentUpdate shouldComponentUpdate(nextProps, nextState) { } I know from this answer that having an empty shouldComponentUpdate ...
gkeenley's user avatar
  • 7,648
1 vote
2 answers
420 views

I'm making a webpage with react-monaco-editor. I realized that after loading the first page, componentDidUpdate is triggered many times, which does not look normal. I tried to add logs in ...
SoftTimur's user avatar
  • 5,770
0 votes
1 answer
42 views

I am trying to write a program that communicates with the client frequently and I need to quickly notice the changes and read the result from the server. But this request is constantly being sent and ...
mohsen bahrami's user avatar
0 votes
0 answers
205 views

I am generating a report for multiple datasets by overlaying WMS images from GeoServer as a slideshow and taking screenshots using the html2canvas library. The problem is that if the user navigates to ...
Abhilash's user avatar
0 votes
0 answers
973 views

We switched to React 18 from react 17. Strangely all the API code that is running during component mount in useEffect has started executing twice. When we applied console we found that it look like ...
Yatin Gupta's user avatar
1 vote
2 answers
5k views

I have a react app with hooks where I needed to replicate the behavior of componentWillMount. I read here that for this purpose useMemo could be used so my code roughly looks like this const Component ...
KiYa's user avatar
  • 11
1 vote
0 answers
41 views

In my React Native app I have a PureComponent where I log whether props or state have changed each time shouldComponentUpdate() is called, like this: shouldComponentUpdate(nextProps, nextState) { ...
gkeenley's user avatar
  • 7,648
0 votes
1 answer
54 views

When it comes to thinking about possibility of props changing, should I only care about parent component updating? Any other possible cases exist for props changing? I can guess only one case like the ...
Leech's user avatar
  • 582
0 votes
1 answer
73 views

The React doc states that the intermediate state will not be shown to the user, but why in this example it does show "loading...." (the intermediate state in this case)? You may call ...
user avatar
1 vote
1 answer
475 views

I'm trying to understand when componentWillUnmount is called. I have this class-based component: class ClassComponent extends React.Component { constructor(props) { super(props); ...
Sam's user avatar
  • 61
0 votes
0 answers
48 views

In my react app , I am creating a canvas element dynamically. Now, I want to access that DOM element from ComponentDidMount lifecycle method, however, I am not able to do that. Below is my code : ...
A.G.Progm.Enthusiast's user avatar
0 votes
1 answer
284 views

I'm a newbie to react.js and i don't know class components.I'm trying hard to understand the react life cycle.
Sohaib Ashraf's user avatar
0 votes
1 answer
2k views

I have a button component that has a button inside that has a state passed to it isActive and a click function. When the button is clicked, the isActive flag will change and depending on that, the app ...
kakakakakakakk's user avatar
2 votes
1 answer
3k views

My question is what does change if you declare a constant above or inside a React functional component (or a class component also)? for example what is the difference if I do: const myName = "...
OlivierL's user avatar

1
2 3 4 5
7