After seeing some discusions around the struggles novices have with certain aspects of blaze (mostly around reactivity and “style”) and having those reasons resonate with my own experiences of training junior developers, I decided to stick some of the boilerplate code we’ve found really helpful into a package: https://atmospherejs.com/znewsham/blaze-component
It wraps a template with a class and provides some helper methods:
setInterval- for deferred functionality that should die with the component
onfor event listeners that can’t be bound to a template, but still need to unbind when the template is destroyed.
- Simplified state and fine-grained data management
- Consistent usage of
- Extendab component functionality
- Testable (as it de-couples the functionality from the event handlers/helpers)
While https://github.com/peerlibrary/meteor-blaze-components is awesome, it hijacks the blaze build system, meaning you can’t easily apply it to some components and not others. Would be interested to know what you think, and if there are other functions you find you often need to implement on a per template basis.