DevIdiot!
useCallback
*useCallback *-> It remembers a new reference while the re-renders-> It returns the same reference value when the depedency array values are not changed-> When depedency values changes it creates a new function referenceeg:const display = useCallback(() => { console.log(count);}, [count]);count same → same function referencecount changed → new function referencereact compare the previous value {count} and the current value {count}
React in Action: State, Events, Inputs & Forms
1. Counter Programimport { useState } from "react";function Counter(){ // let i=0; // return( // <div> // <h1>Count : {i} </h1> // <button onClick= {increament}></button> // </div> // ) console.log("component ReRendered...."); // let cout = 0 const [count, setCount] = useState(0); function increment(){ // count++ // console.log(count) setCount(count + 1); //setCount(500); } func
Build an Offline-First Zakat & Nisab Calculator in React Using a JSON API
Zakat calculators are a nice small project: a bit of state, a bit of math, and some real-world concerns like offline use, number formatting and right-to-left text. In this tutorial we build one in React, using the Zakat API from QuraniAPI as the data source.Important: this is a coding tutorial, not a religious ruling. Please confirm rulings and your personal calculation with a qualified scholar. What the API gives usThe Zakat endpoint is documented on its API page and in the docs. The slug
Make your React/Vite SPA readable by AI crawlers without rewriting it
Short answer: a React or Vite app sends an empty <div id="root"></div> and builds the page in the browser. AI crawlers don't run that JavaScript, so to ChatGPT, Claude and Perplexity your site has no text. Pre-render it: build the HTML of each route at deploy time with a 15-line script, and React takes over in the browser as usual. You don't need to rewrite anything in Next.js.When I audited 286 developer portfolios for an earlier study, 98 of them (34%) showed fewer than 20 words to
De planilhas estáticas a Agent Skills: como estruturar BI e monetizar engenharia na Agensi
Dados comerciais perdem valor estratégico quando ficam presos em planilhas estáticas e análises manuais. Ao mesmo tempo, pedir para um agente de IA gerar dashboards complexos do zero a cada sessão aumenta o risco de alucinação de estado, inconsistência visual e retrabalho estrutural.O Inteligência de Vendas Atlas (insights-playground-52) foi projetado para resolver esses dois gargalos: transformar bases tabulares em painéis executivos interativos e empacotar essa solução como uma Agent Skill pro
MDX – Markdown Meets React Components
Originally published with interactive examples at lukiluki.me.You are writing technical documentation in Markdown. Plain text works until the reader needs a calculator, a live example or a reusable warning box. Copying HTML fragments across articles makes them harder to maintain. How can a document stay readable while using the same components as the application?MDX combines Markdown with JSX, so documents can import and render React components. In the Next.js App Router, local MDX can participa
lazy , suspense
<p><strong>Lazy:</strong></p><p>It actually prevent from the initially download and the component should be loaded when the component is needed.</p><p><strong>lazy syntax:</strong></p><p>const About = lazy(() => import('./About'));</p><p><strong>Suspense:</strong><br>This when the component gets loaded on that time it displays a fallback "Loading..." has temporarily.</p><p>suspense syntax:<br>Loading...}><br> <br></p>
Keep heavy React components out of the main chunk with react-view-import
My next project needed a fully static output, but most of its work happened on the client side. The client judged the site by its Google page-performance score, so the first load had to stay as light as possible.The usual lazy-loading options did not give me what I needed. In my static export setup, a lazily loaded component still weighed on the first load. I wanted something more direct: the component is excluded from the main chunk, the site manifest keeps only a reference to it, and the chunk
Building Better Web Experiences with React: From Components to Full-Stack Integration
Modern web applications require more than attractive designs. They need to be interactive, responsive, maintainable, and capable of communicating with backend services. React.js has become a popular choice for frontend development because it helps developers build dynamic user interfaces through a component-based approach.As part of my software development internship at Valentius Kryptix, I worked on improving an existing portfolio web application by transitioning its frontend towards React. Thi
What a font generator changes at the code-point level
I wanted to know what a font generator is actually emitting when it shows a "bold" preview. Not a typeface file — I already suspected that — but the exact code points sitting on the clipboard.This article was created with the help of AI. I also operate FontLemon, the site I link to later. The snippets below were run in Node 24 and Python 3.13 before I pasted them here.I typed Font into a font generator and copied the first heavy row. What I got back was not the letters F, o, n, and t with a weig
Exact Gacha Soft-Pity & M0W1 Probability in ~40 Lines of Vanilla JS (No Monte Carlo)
When building a browser-based pull planner for Zenless Zone Zero (Polychrome Calculator), I hit a classic probability modeling trade-off:Naive geometric formulas break completely once soft pity ramps up.Monte Carlo simulations (e.g., 10,000 random trials per slider tick) produce jittery numbers and feel sluggish on mid-range phones.Because hard pity is bounded (90 pulls for Exclusive Agents, 80 pulls for W-Engines), the entire state space is tiny. We can compute exact cumulative odds instantaneo
One Account, Every Customer: Share Your API Connections Without Handing Out the Keys
Some accounts in your SaaS aren't your customers'. They're yours: the Slack workspace your alerts go to, the enrichment API you pay for, your own SMTP relay.When a customer builds an automation that needs one of those, you have two bad options. Ask every customer to paste the same API key (pointless), or hand each of them a copy they can rotate or delete (worse).What you want is one connection that every user can pick and nobody but you can touch. In ByteChef Embedded that's a shared connection:
High Impressions, Almost No Clicks: A Developer's Checklist for Fixing Low CTR in Google Search Console
A page can rank on page one or two, collect hundreds of impressions every month and still get almost no clicks. When we looked at our own Search Console data recently, one service page had close to a thousand impressions in 28 days and a click-through rate that rounded to zero. The page wasn't broken. The snippet was simply not worth clicking.Here is the checklist we now run on every page that shows high impressions and CTR under 2%. 1. Confirm it is a snippet problem, not a position proble
A party word game that needs no host (and no lobby)
The first version of our party word game had a lobby, a rules screen, a ready check and a host. It took ninety seconds to get four people into a game, and about half of those ninety seconds were one person saying "wait, who is the host?"We deleted the lobby. Not because lobbies are bad, but because a game you play twice a year cannot afford a setup ceremony. The rule we settled onOne person opens a room, gets a six-character code, and reads it out. Everyone else types it. There is no accoun
The Dirac Equation Is Geometry — From Two Arrows to Antimatter (Interactive)
In 1928 a 25-year-old Paul Dirac needed a square root that ordinary numbers cannot take. The objects he found predicted the spin of the electron and, three years later, antimatter — which today is produced inside every patient in a PET scanner. This post shows that his square root is the same thing as multiplying two arrows.The full version — three acts, ~16,000 words, 11 interactive widgets — is on my blog: From Arrow to Positron. Here is the condensed, math-first path through it.One rule shape
Reduce CI costs by optimizing front-end DOM testing
Most modern web development teams utilize Node.js environments to run component tests for frameworks like React or Vue rather than using actual browsers. This process relies on a simulated Document Object Model to handle interactions, which often leads to significant performance bottlenecks and high continuous integration costs. Measuring the Performance Cost of DOM SimulationsComponent testing involves constant interaction with simulated browser environments. Every time a test script click
Compare intrinsic and rendered image widths when debugging layout
Start with two numbers when a photo preview looks blurry. After the image loads, read its naturalWidth and its getBoundingClientRect().width. The first is the intrinsic width in CSS pixels. The second is the width of the rendered box. Use an image with no border or transform for this check.If the intrinsic width is 400 CSS pixels and the box is 600 CSS pixels wide, look for the layout rule that widens the preview. For an image with responsive sources, check currentSrc as well. It shows which res
Solving peg solitaire with a golden peg: bitmasks, a dead-position memo and backward puzzle generation
Peg solitaire is a good small search problem: the board is tiny, the rules fit in one sentence, and a naive solver can still waste a lot of time. I wrote a dependency-free JavaScript solver for a browser puzzle and want to show the two ideas that matter, plus a twist that changes the search slightly.The code is in the peg-solver repository (MIT licence). It is the same logic that checks the puzzles in a free acorn-themed game at cozypuzzlegames.com/peg-solitaire. Representing the boardA boa
Build a Password Generator App with JavaScript
Every account needs a strong password, and nobody can remember twenty different ones. A password generator is a small, genuinely useful project: it teaches random selection, character sets, and clipboard handling, and you end up with a tool you will actually use.Start with the character sets:const SETS = { lower: "abcdefghijklmnopqrstuvwxyz", upper: "ABCDEFGHIJKLMNOPQRSTUVWXYZ", numbers: "0123456789", symbols: "!@#$%^&*",};Let the user pick a length with a slider and toggle each set on o
Build a Bill Splitter App with JavaScript
Splitting a bill between friends sounds trivial until you try it: one person paid, three people shared, someone only had a starter, and the tip needs splitting too. A bill splitter app is a great beginner project because the logic is real arithmetic that users can check by hand.Start with the inputs: the total bill, the tip percentage, and the number of people. The core calculation is two lines:function splitBill(total, tipPercent, people) { const tip = (total * tipPercent) / 100; const perPer