func this.setState() error loop
See original GitHub issueHi, I use
<Tour
steps={steps}
isOpen={this.state.isTourOpen}
onRequestClose={this.closeTour}
getCurrentStep={()=>this.setState({test:false})}
/>
or
{
selector: '[data-tut="reactour__logo"]',
content: `And this is our cool bus...`,
action:()=>{ this.setState({test:false}) }
},
In this.setState({test:false})
code , will report an error in the loop…
help me~~~
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Why this setState caused infinite loop? - Stack Overflow
I created a react component with rendering call details, in component I use useEffect to set the callInfo state, then it caused infinite...
Read more >How to solve the React useEffect Hook's infinite loop patterns
Solve the issue of infinite loops when using the useEffect Hook in React to more smoothly utilize the Hook for your app's side...
Read more >React setState usage and gotchas - ITNEXT
setState() enqueues changes to the component state and tells React that this component and its children need to be re-rendered with the updated...
Read more >5 useEffect Infinite Loop Patterns | by Naveen DA
The function getData is passed as dependencies. When you run this code, it will throw Maximum update depth exceeded which means the code...
Read more >How to Solve the Infinite Loop of React.useEffect()
1.1 Fixing dependencies ... The infinite loop is fixed by correct management of the useEffect(callback, dependencies) dependencies argument.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
thanks, you are good man @elrumordelaluz
Try doing something a little safer like:
However I am curious about the reason/s. Just to know if the API needs any improves.