2021-05-24
3517
#react
Sebastian Weber
50000
May 24, 2021 ⋅ 12 min read

useState vs. useRef: Similarities, differences, and use cases

Sebastian Weber Fell in love with CSS and JS over 20 years ago.

Recent posts:

Why Go wasn’t the right choice for the TypeScript compiler

Why Go wasn’t the right choice for the TypeScript compiler

The switch to Go may be a pragmatic move in the short term, but it risks alienating the very developers who built the tools that made TypeScript indispensable in the first place.

Muhammed Ali
May 8, 2025 ⋅ 4 min read

How to format dates in JavaScript: Methods, libraries, and best practices

JavaScript date handling can be tough. Here are some native Date API tools and specialized libraries to tackle them with.

Nelson Michael
May 8, 2025 ⋅ 8 min read
tailwind typography

How to use the Tailwind Typography plugin

Walk you through how to set up and use the Tailwind Typography plugin, also known as the @tailwindcss/typography or the prose plugin.

David Omotayo
May 7, 2025 ⋅ 7 min read
Running TypeScript In Node.js: Tsx Vs. Ts-node Vs. Native

Running TypeScript in Node.js: tsx vs. ts-node vs. native

TypeScript adds static typing to JavaScript code, which helps reduce unpredictable behavior and bugs. In the past, TypeScript code couldn’t […]

Amazing Enyichi Agu
May 7, 2025 ⋅ 8 min read
View all posts

One Reply to "<code>useState</code> vs. <code>useRef</code>: Similarities, differences, and use cases"

  1. Don’t use:
    `App ${darkMode && “dark-mode”}`
    As it will result with an “App false” class, if dark mode is disabled.

    Instead, use:
    `App ${darkMode && “dark-mode” || “”}`
    or
    `App ${darkMode ? “dark-mode” : “”}`
    to generate “App ” as the class when dark mode is disabled.

Leave a Reply