Video: Template state communication

I wanted to help my students understand how to decompose their “page-level” templates into “component-level” templates, which often requires the ability to communicate state information between the components. I couldn’t find a simple explanation of a simple design pattern to do this, and so here is my attempt to do both:

Would be interested in your thoughts and whether there are good alternatives to this approach.

Philip

1 Like

I enjoyed that - it was presented well and I thought the use of ReactiveDict was good. However, you explicitly ruled out Mongo, whereas it might be worth considering a client-only collection as an alternative.

I recall a blog post about a year or so ago in which the basic approach as you presented was discussed (it may have used Session - I can’t recall). Annoyingly, I can’t find it now!

Edit: Found it. It wasn’t quite as I had remembered it, but it may be useful to compare approaches:

https://www.discovermeteor.com/blog/meteor-components-template-controller-pattern/

Thanks for the video.

I recently implemented a very similar feature to view details of events from a calendar. I ended up doing the exact same thing - except I used a reactiveVar which just contained an object. I didn’t know reactiveDict was even a thing.