Snippets

Group in a group with TailwindCSS.

Some time ago, there was a common problem of having multiple nested group classes. Imagine having a main menu dropdown group, where top level elements are groups, and sub-level elements are groups as well. You might be tempted to use something like this:

<ul class="relative">
  <li class="group">
    Top level item
    <ul class="hidden group-hover:block">
      <li class="group">
        Sub level items will be here
        <ul class="hidden group-hover:block">
          <li>Sub-sub level item 1</li>
          <li>Sub-sub level item 2</li>
          <li>Sub-sub level item 3</li>
        </ul>
      </li>
    </ul>
  </li>
</ul>

While this looks correct at first glance, but you will have all the nested levels displayed on hover over the top level item. And here’s a solution.

Group in a group with TailwindCSS. Read More »

clearTimeout or clearInterval in React Native views with React Navigation

When working on a regular React app, it is common to initialize some hooks after the component is mounted, and unbind them after the component is unmounted. However, while working on a React Native app, you might have noticed that the views are actually not unmounted, and as such your bound events and background tasks continue to run from the previous view. Here’s what you can do.

clearTimeout or clearInterval in React Native views with React Navigation Read More »

error TS2792: Cannot find module ‘moment’. Did you mean to set the ‘moduleResolution’ option to ‘node’, or to add aliases to the ‘paths’ option?

error TS2792: Cannot find module ‘moment’. Did you mean to set the ‘moduleResolution’ option to ‘node’, or to add aliases to the ‘paths’ option? Read More »

Cannot augment module ‘console’ with value exports because it resolves to a non-module entity.

This error message appears when typings are exposed globally, yet TypeScript tries to validate module typings and the names conflict.

Cannot augment module ‘console’ with value exports because it resolves to a non-module entity. Read More »

5 ways to create an HTTP/HTTP2 server with Node.js.

Node.js can be used to easily run a web server by using the built-in HTTP module or a web framework such as Express, Hapi, or Fastify. The process involves creating an HTTP server, setting up routes, and starting the server to listen on a specific port for incoming requests.

5 ways to create an HTTP/HTTP2 server with Node.js. Read More »