JSFiddle - React, Tailwind, and code Playground
JavaScript
function myStore() {
items = [];
this.add = function(item) {
items.push(item);
};
this.all = function() {
return items;
};
}
let store = new myStore;
console.log(store.all());
store.add('test');
console.log(store.all());