Questions tagged [react-effects]
11 questions
4
votes
1 answer
React form loses focus on update
I am working on a form that has, among other fields, calendar entries - dates and times. The code is below:
{dates.map((d, i) => (

Igor Shmukler
- 1,742
- 3
- 15
- 48
3
votes
2 answers
React useEffect run conditionally
How do I prevent my React component from fetching images every time the component is rendered and to fetch them from the store instead? I don't want to get rate limited by doing the API call over and over again, but the problem with useEffect is…

Florestan Korp
- 662
- 2
- 12
- 24
1
vote
0 answers
React - is this some kind of fake render?
Why setting state to same value executes the body of the component?
here is the demo:
https://codesandbox.io/s/react-fake-render-lcrcpd
Why setting the state to the same value "t" causes "rerender"?
Why console.log in the body of the component logs…

Oktay Yuzcan
- 2,097
- 1
- 6
- 15
1
vote
3 answers
(React Native) How to Class to Function
My English is not very good; I prepared an application. I want to use the following class structure as a function or a const. How can I do that? I want to use the function component to use props.
I added the entire code.
Age calculation app.
I used…

kikirim
- 37
- 8
1
vote
2 answers
React useEffect, dependency list not working
I'm sure I have got the wrong understanding on this. I have the following component
const Comp = () => {
const filter = 'a';
useEffect(() => {
console.log('executing effect');
loadFriends();
}, [filter]);
return (
…

tmp dev
- 8,043
- 16
- 53
- 108
0
votes
1 answer
React useEffect unexpected reference to the latest props values on unmount
The following component includes an useEffect that should run on mount and then cleanup the effect:
const Group = ({
children,
accessor,
disabled = false,
}: {
children: React.ReactNode
accessor: Accessor
disabled?: boolean
}) => {
…

Antonio Santoro
- 147
- 11
0
votes
1 answer
React ovverride shown component with new component after server response
I would want load new component after server response using React. Its could be a simple operation but something does not working at the moment. My code is the following:
const formSubmit = async e => {
e.preventDefault();
const response =…

init
- 55
- 8
0
votes
1 answer
Warning 'React hook useEffect has a missing dependency'
In a React app I get this warning on a few components in the useEffect function. I have seen other SO questions but still cant see a fix.
React Hook useEffect has a missing dependency: 'digiti' and 'time'. Either include it or remove the dependency…

Phuong
- 329
- 2
- 7
- 15
0
votes
3 answers
React Native how to fetch data video link from local json file on react native
I prepared an application, I need to get the video links from the data file. What can I do for that.
source={{ ? }} and How do I project 4 videos to the screen using flatlist? Thank you
export const data = [
{
id: 1,
name: "Video1",
…

kikirim
- 37
- 8
0
votes
1 answer
setState via ref not working inside useEffect?
I'm trying to clear filtered state of a react table component using useRef viz. ref.current.setState({...}).
This is a snippet from my component:
const Customers = (props) => {
const customerTableRef = useRef()
useEffect(() => {
const…

dsfx3d
- 372
- 2
- 12
0
votes
1 answer
React Cleanup async function fetch with hooks
This is in a functional component.
I have a submit() function that looks like so:
async function handleSubmit(event) {
event.preventDefault();
try {
let resp = await fetch("FOOBAR/BAX", {
method: 'POST',
body:…

mtyson
- 8,196
- 16
- 66
- 106