In a TypeScript application ESLint flags code when we try to assign “null” value to string type variables and attributes. This can be necessary when we want to set the value of a database column to “null”. To make a string type attribute nullable, add ” | null ” to the type definition:
Category Archives: Not for home page
Error: Component definition is missing display name react/display-name
If you use the VirtualTable in a React TypeScript web application ESLint will throw an error when it checks the VirtuosoTableComponents. Error: Component definition is missing display name react/display-name The Virtuoso component uses arrow functions to declare the Scroller and TableBody. Arrow functions do not provide the displayName property used by developer tools. We can modify the component to …
Continue reading “Error: Component definition is missing display name react/display-name”
Horizontal scrolling cards
We can use simple CSS settings to scroll cards horizontally in a container. Apply these settings to the container <div>: Configure the card <div>s with this:
Creating tables with PostgreSQL
Identity columns There are three auto incremented identity columns types in PostgreSQL Name Storage Range SMALLSERIAL 2 bytes 1 to 32,767 SERIAL 4 bytes 1 to 2,147,483,647 BIGSERIAL 8 bytes 1 to 9,223,372,036,854,775,807 To create a new identity column use the following syntax
… you might have mixed up default and named imports
In a Next.js React web application we can export functionality two ways: The two definitions have to be imported with two different syntaxes If we try to use the wrong import statement, we get the following error message: Make sure your import statement matches the definition format.
The top-level-await experiment is not enabled
When we try to call an async function with await from a .tsx file in a Next.js React TypeScript web application we get the error message: Module parse failed: The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it) Error: The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it) The …
Continue reading “The top-level-await experiment is not enabled”
Module not found: Can’t resolve ‘fs’
If you use Webpack version 5 or later you may encounter the error message Module not found: Can’t resolve ‘fs’ The cause is, that Webpack 5 has a breaking change, and the “fs” module is most likely not included anymore in the client-side code. To eliminate the issue, add the “browser” element to the package.js …
Creating favicon.ico on macOS
The favicon.ico file contains icons in four different sizes: To create a new favicon on a Mac, open an existing one in Preview and edit all four versions of it. Save the file, and the browser will select the appropriate size to display it on the tab.
Linking between pages in multi page Next.js React web applications
The Next.js React sample project only contains a single “Index” page. If your web site has multiple pages, you need to set up simple routing to call them from each other. In this example we will use the “Link” Next.js React component to call two pages from each other with the minimum number of instructions …
Continue reading “Linking between pages in multi page Next.js React web applications”
How to name individual street segments in Cities: Skylines
The Cities: Skylines AI automatically estimates the length of the street, and the name applies to the entire length. In real life after a turn, a corner, or an intersection the street’s name can change. To adjust the street segment where the name applies: