Last week, I was creating an app and coloring the different elements using CSS color codes when I noticed something strange. The color code (255, 255, 255) – which represents mixing equal amounts of red, green, and blue – specifies white. But, as I learned as a 5 or 6 year old in art class, combining red, green and blue paint makes a muddy grey-brown color.
After writing a long post on CSS positioning, I thought I had a good grasp of the five position types, and I was excited to apply my knowledge. One week later, I’m questioning whether I really understand positioning at all.
When I first started coding, I treated CSS as an afterthought, something I stumbled through at the end of the project to make the result look presentable. Because I didn’t have a great conceptual understanding of CSS, I ended up learning about concepts like positioning through trial and error, a messy process that often left me frustrated. A couple months ago, I finally decided to put in the time upfront to learn CSS fully and deeply. Partially to solidify my own understanding and partially to help out anyone else trying to make sense of CSS fundamentals, I’ve constructed a kind of “cheat sheet” that reviews all the possible values of the “position” property: static, relative, absolute, fixed and sticky.
In my opinion, context is one of the oddest-looking and least intuitive features of React. To understand React context, I first tried to understand the types of situations where context is useful. Why would anyone want to use such a complicated-looking interface in the first place?
Last week, I designed a one-page application in Javascript for helping people ID plants. The application fetched plant data from an API and rendered plant objects to the screen. When I started my project, I knew my code relied on Javascript “promise objects”. I knew that promise objects receive and manipulate data from other webpages. I knew that when I wrote statements like fetch(‘http://localhost/plants/13’).then(response => console.log(response), I created promise objects. Other than that, I didn’t know much else about promises, the objects that allowed my website to do fundamental actions like get and edit data. I set off on a quest to learn more about promises, and ended up writing code to create promises from scratch. Now, I hope I can relate what I’ve learned clearly and concisely, so others, too, can understand the deep magic of promises. Like onions and ogres, promises have layers. Let’s peel them back, one by one.