Hey! If you have ever worked with Vue.js, Ember or MobX I’m pretty sure you stumbled upon so-called computed properties. They allow you to create functions that can be accessed just like normal values, but once computed they are cached until one of its dependencies has changed. In general this is a concept very similar to getters and in fact, the following implementation will be using getters. In a smart way. ;)
There are already good validator libraries dedicated for Vue.js like vue-validator or vee-validate.
With the growing need for robust and interactive web interfaces, many developers have started embracing the reactive programming paradigm.
Before we begin implementing our own reactive engine, let’s quickly explain what reactive programming actually is. Wikipedia gives us a classic example of a reactive interface implementation – namely a spreadsheet. Defining a formula such as
=A1+B1 would update the cell whenever either
B1 change. Such a formula can be considered a computed value.