πŸ”₯ There are 260 Hot Tips!!

Hot tips are spicy lil' nuggets related to web development and tooling that I share on my twitter account. I've logged them here to make them easier to find.

πŸ”₯ If you are in a react component where you destructure a prop and find yourself needing to see what other props are available, use an ...Object Rest to collect the rest of the props in a single object

2834435

πŸ”₯ JavaScript functions visualized! This is a screenshot from my Beginner JavaScript course.

3.9K1K50273

πŸ”₯ CSS variables can be set to other CSS variables. Also we will soon be able to tweak colours with colour functions in CSS directly.

Good for Canadians who can never remember which way to spell grey

6651362423

πŸ”₯ When using JavaScript default function params, you can access other params from right inside the definition!

2.5K66669121

πŸ”₯ Use npm init --yes to skip all the questions and create a package.json

(I'll still just lean on the enter button until it's done, but enjoy the tip πŸ˜ƒ)

46682215

πŸ”₯ Canvas tip I just learned from @jake_albaugh. You can paint to a really small canvas to get quick+cheap colour processing and you can visualize it with canvas { image-rendering: pixelated; } 🀯 This is a 35x35 canvas

116590

πŸ”₯ Intersection Observer is handy for when you need to disable a UI until something has been shown on screen. In this case we can check if the last element of a terms and conditions has been totally shown before enabling the accept button. code in followup tweet πŸ‘‡πŸ»

350721026

πŸ”₯ Nice little trick adapted from @Fotiman after the most recent @syntaxfm

Get an array of all month/day names using .toLocaleDateString()

1.1K2421999

πŸ”₯ If you are trying to add/remove multiple classes from an element, an array spread is the perfect use case here since classList.remove() requires multiple arguments.

Instead of it passing in 1 array arg, it passes each item of the array as a separate argument

23637513

πŸ”₯ If the Fetch API seems a little cumbersome and you don’t want to reach for Axios, you can always make a handy little function that applies your defaults (assumes JSON) and can be overwritten if needed

1.1K1953073