H
H
hateyyyy2016-03-07 14:55:42
JavaScript
hateyyyy, 2016-03-07 14:55:42

Why is shouldComponentUpdate called?

There are two components.
In the first I change the state -> in the second, shouldComponentUpdate is called.
Shouldn't this be happening?
Maybe this is due to the use of es6, in one and the other component

constructor(props) {
        super(props);
        this.state = {
            select: false
        };
    }

Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Gushchin, 2016-03-07
@iNikNik

You didn't provide code, but shouldComponentUpdate is called before the renderer. When you change the state of the parent component, it is re-rendered, which means that all child components also go to the re-render.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question