Closed benjamminf closed 8 years ago
Looking into some examples, I see context
is generally used to hold actions for state management (redux). This is a much better idea.
Hi,t
You are right, context
is for passing some context (😃 ) through component hierarchy.
It's same as reacts contexts: https://facebook.github.io/react/docs/context.html
Ah okay, thanks! I've never used React before, and as far as I know there's no explicit controlling of component context in Vue. Cheers for the link!
I'm not sure exactly what the purpose of the
context
parameter is when rendering templates. In the API reference, the only note on this parameter is:Does this mean any descendant components initialised in the rendered template will have the
context
data passed to it as well?My first thought was that
context
provided a way of passing in extra "global" properties that could be used in templates. After looking through the source I realised this wasn't the case, so I modified myupdate
methods in all my components like so:Is this an appropriate use of the
context
parameter?