DEV Community

Cover image for 4 Things I Have Read That Are Good for Web Devs
Junsu Park
Junsu Park

Posted on

4 Things I Have Read That Are Good for Web Devs

I usually write about what I made and learned, but this time, I wanted to share knowledge I gained from other people. I think these 3 articles and 1 documentary will help you become a better web developer.

Rules of Margin Collapse by Josh Comeau

CSS rules are frustrating are a nightmare. What is even more frustrating are behaviors that are not well documented. One of these are CSS margins. Here’s an example: did you know margins only collapse vertically?

Horizontal margins do not collapse

Thankfully, Josh Comeau has written all the weird arbitrary rules that margins have. I personally won’t be using margin unless it’s for one-off spacing that Flexbox gap wouldn’t work for.

The Uphill Battle of Memoization by TkDodo

React re-renders are hard to tame. Any state change in a component will propagate re-renders to all its children components. You may already know some ways to isolate re-renders:

  1. Move state down
    1. If state can’t be moved down, use a global state management with atomic picks to isolate re-renders
  2. Pass the component as a prop or children

There’s also React.memo but TkDodo warns against using it for very good reasons. For example, using inline props can easily break it since inline functions and objects are recreated when the component re-renders.

Operating without Foreign Key Constraints by Planetscale

This article is from the Planetscale’s documentation, which is a MySQL serverless database service. Planetscale explains it doesn’t support foreign key constraints because it interferes with Online DDL operations and it becomes harder to maintain over multiple database servers. By enforcing referential integrity at the application level instead of at the database level, Planetscale can benefit from online DDL and unlimited scaling through sharding.

Initially I thought this was a weird approach but I agreed with it after reading through the page. I love it when developers rethink best practices.

How a Small Team of Developers Created React at Facebook | React.js: The Documentary by Honeypot

Speaking of rethinking best practices, this 76 minute documentary goes into the origin and early public reception to React when it was released as open source. The initial reception was extremely negative; people hated JSX and thought React broke separation of concerns.

React doubters tweet about JSX

React doubters tweet about separation of concerns

Thankfully, early adopters started using React, few in production, and an open source community quickly grew around React, which the React team cultivated by fixing bugs, releasing new features, and organizing meetups. I found this documentary inspiring for two reasons.

  1. I’m now a full stack engineer with a year of professional experience under my belt and I have spent almost all of my time deferring to other people’s opinions on how things should be built. And I should since I don’t know much. But now as I gain more experience, I am starting to become more opinionated. And the fact that traditional best practices have been broken and innovated upon gives me confidence to experiment and try out new approaches.
  2. The strength of the open source community makes me want to contribute to open source projects. I think it’s beautiful to see really smart people passionately work together for no compensation just because they love building cool things. And I want to be part of that.

Top comments (0)