Scenario:
Component A is parent of Component B.
A has a prop called a of type String.
B has a state called b of type Int.
b is 42
a is "hello"
Now I re-render A using render() and set a to be "hi!".
What happens to b ? Will it still be 42 after the re-render ? Why ?
Some related background questions about the why:
My initial guess is that 42 will get lost and the child component will be re-initialized with 0 or something default. But that would not make much sense, it would not be very useful, but I just don't see how the state of the child components will survive ?
Maybe I don't understand what is the difference between a stateful component and VDOM and how they relate to eachother.
1) Is a stateful component a template which is used to create a corresponding VDOM ? Is it so that the render() method takes a (stateful) component and spits out a VDOM and then this vdom is what will be rendered in the browser after render() created the vdom ?
2) Is it so that practically a stateless component equals a piece of VDOM but the same stateful component can generate many different VDOM-s ?
3) What is the mental model of react that I need to have in my head so that I can reason about this situation ? I think I am missing here something.