Skip to main content
Zubin KhavarianZubin Khavarian

Writing / tag

#react

React patterns, and when a clever one earns its place. One post, newest first.

switch(true) in React: First True Wins

5 min read

switch(true) runs the first case that is true, which makes it a tidy way to write ordered conditions. It is the right tool less often than it looks. Here is when it earns its place.

#react#javascript

All writing

zubin@zubin.dev: man keys

// go to

  • ghhome
  • gwwriting
  • gaapps
  • gpprojects
  • goopen source
  • gnnow
  • guuses

// move

  • jscroll down
  • kscroll up
  • ggtop of page
  • Gbottom of page
  • }next section (posts)
  • {previous section (posts)
  • ]newer post
  • [older post

// do

  • ⌘Ksearch everything
  • /search, too
  • ttoggle light / dark
  • ?this sheet
  • escclose