September 2017
Intermediate to advanced
216 pages
6h 8m
English
Let's add a separate side-effect function that updates the result count:
const app = App(Map.of( Map.of(...), Map.of( 'results', Seq.of( (results) => { const count = results .get('episodes') .toSeq() .filter(filter(results.toJS())) .count(); document .getElementById('results') .querySelector('h3') .textContent = document .getElementById('results') .querySelector('h3') .textContent .replace(/\d*/, count); }, ) )));
In this case, we're executing the same query that's executed when the episodes are rendered, except in this function, we're counting values instead of iterating over the results. On the one hand, we have a separate side-effect function to handle rendering the result count. On the other hand, we're being ...
Read now
Unlock full access