mangojassi
context
Hi all, I have a question about context scoping.
In the example above, I have three main components and a HOC which wraps a component in a context.
C
renders A
which contains 2 B
s as children. A
also has a provider wrapped around it.
Within all three components, I try to retrieve a context called FooContext
which is provided by the aforementioned HOC.
As expected I was not able to retrieve the context in C
but I was initially surprised that I am not able to retrieve the context in the first B
but I am able to in the second B
. I assume that this is because it lazily initialized so it is put in the "expected" place in the owner tree.
First I just wanted to check if this is expected behaviour.
Secondly is there anyway to catch these kinds of subtle issues in the future e.g. in a lint rule?4 replies