1 hour ago · Tech · hide

While simple, today I used this trick to write the code I wanted. Variable assignment of a function is a valid, communicative way to alias a function in JavaScript. const clearFilters = () => setFilters({}); // Use the same behavior when starting a new search. const startNewSearch = clearFilters; // These create the same result. clearFilters(); startNewSearch(); In this case, calling clearFilters didn’t fit with a click handler on a button labeled “Start New Search.” With this technique, was able to call the function I wanted, abstracting its implementation.

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town