Frontend

Argument of type ‘FormData’ is not assignable to parameter of type ‘string | string[][] | Record | URLSearchParams | undefined’.

Argument of type ‘FormData’ is not assignable to parameter of type ‘string | string[][] | Record | URLSearchParams | undefined’. Read More »

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 »

Next.js ChunkLoadError: Loading chunk failed after deploying.

Everything was working fine locally, but the whole console gets red with ChunkLoadError after you deploy to production. Moreover, the frontend becomes blank white and you see Application error: a client-side exception has occurred (see the browser console for more information). The issue seems to be here for a while, and it looks like no-one knows which part exactly is responsible for the error (Next.js or Webpack or both), but the workaround is present.

Next.js ChunkLoadError: Loading chunk failed after deploying. Read More »

How to call child component method with forwardRef and useImperativeHandle in React

Calling a child method is a common architecture problem that occurs in a React app. You can pass individual properties to child components, you can alter the component state inside of the same component, but how to actually call another component’s method?

How to call child component method with forwardRef and useImperativeHandle in React Read More »

[!] RollupError: Node tried to load your configuration as an ES module even though it is likely CommonJS. To resolve this, change the extension of your configuration to “.cjs” or pass the “–bundleConfigAsCjs” flag.

[!] RollupError: Node tried to load your configuration as an ES module even though it is likely CommonJS. To resolve this, change the extension of your configuration to “.cjs” or pass the “–bundleConfigAsCjs” flag. Read More »