React – memory leaks

Consider 2 components – PlaylistsComponent, and PlaylistComponent. PlaylistComponent is only visible via PlaylistsComponent if there are songs related to that playlist and PlaylistComponent holds the count of those songs inside its own component state, the conditional visibility is controlled by PlaylistsComponent. PlaylistComponent can remove songs via a remove function that is passed down from PlaylistsComponent,… Continue reading React – memory leaks

Published
Categorized as React

Javascript – avoid nesting ifs

When writing conditional blocks of logic try to avoid nesting, for example, consider the below: This kind of nesting can make code hard to extend, hard to read and hard to debug, so we can move everything up to the top level like:

Published
Categorized as Javascript