Skip to content

Instantly share code, notes, and snippets.

Three Tips For Optimizing Your react-redux Applications

Tip #1: When subscribing a component to the store, only subscribe to the specific data it needs

// Before
let selectedId = useSelector(state => state.list.selectedId);
let isSelected = props.id === selectedId;

A Gentle Introduction to TypeScript

JavaScript's Types

JavaScript is a dynamically typed programming language, which means a variable's type can change while the code is executing.

var dinner = 'tacos';
console.log(dinner); // 'tacos'
dinner = 12;
console.log(dinner); // 12

Blog Post Improvements

Identifying Improvements

The blog post I'm hoping to help improve is The Ultimate Guide to Hoisting, Scopes, and Closures in JavaScript.

Just a quick note, the YouTube video for this post links to The Evolution of Async JavaScript: From Callbacks, to Promises, to Async/Await when it should be linked here.

This post is absolutely fantastic. Execution context is critical to understanding so much about JavaScript, and approaching topics such as hoisting and closures from this perspective has made me a much better programmer.

However, JavaScript's "scope" doesn't fit well with execution context because its scope is lexical, not dynamic.