Helo guys, i trying to use Refs and to give this.setStateinside his but it give:
Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.
How i'm doing:
ref = {
(anchor) => this.setState({
anchor
})
} >
But when i use:
ref = {
(anchor) => this.state.anchor = anchor
} >
it works..
And in other component, i use this.setState also and it works perfectly, someone why?