Every now and then, I discover I've been tackling a problem the hard way for years, only to find out there was a simple trick all along that could have made my life so much easier.
Surely I'm not the only one?! :'-)
Have you had a similar experience? What simple thing did you discover late that could have made your work easier? It doesn't have to be about web development or even coding.
I'd love to hear about your stories!
Top comments (3)
In general we tend to not leverage the browsers capabilities. Native form handling is one example, or just using the url to track state, or using tons of Javascript for things that can (mostly) be done in CSS.
I'll start.
For years, whenever I needed to handle an error in an RxJS stream with a side effect, I would catch the error and then rethrow it using catchError and throwError. Instead, I could have simply used tap:
Another RxJS one:
I often combine streams with
forkJoinorcombineLatestand want the output as an object with stream names as keys. Before, I did it like this:But, you can directly do: