#frontend
Posts tagged #frontend on Dynamo Geeks: 22 posts from the community, most useful first.
Posts tagged #frontend
please how do i fix my react timer, it stays at 1 😭
good evening everyone 🙏🏾 i'm building a pomodoro timer for my portfolio. the seconds go from 0 to 1 and then it just stays at 1 forever. no error in the console. i just came across something called "stale closure" but i don't understand it. here is my code: import { useEffect, useState } from 'react' function Timer() { const [seconds, setSeconds] = useState(0) useEffect(() => { const id = setInterval(() => {…
paano po gawing 3 columns sa laptop tapos 1 column sa phone? (CSS grid)
sorry po if basic question 😭 kakatapos lang ng shift ko kaya medyo lutang pa. practice project ko po is portfolio page na may project cards. gusto ko 3 columns sa laptop, 2 sa tablet, 1 sa phone. ginawa ko po 3 media queries pero ang dami tapos may weird na gap sa tablet size: .projects { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; } @media (max-width: 900px) { .projects { grid-template-columns:…
AI tool generated our new component library. Then the accessibility audit came back with 143 issues
회사 이름은 말 못 하지만... big portal company, React + TS. We had a deadline (always deadline) for new design system components. Management bought an AI tool that generates components from Figma, and the team was told: use it, ship faster. We shipped faster. 진짜 빨랐어요. 3 weeks instead of 8. Then the accessibility audit. 143 issues on the first 12 components. Some examples: Buttons were divs. <div onClick={...}> with no role,…
useEffect fetch running twice in my take-home test?? is my code broken
doing a take-home for a junior role (round 2, we move 💪). simple React app that fetches a list of products. in the network tab i can see the request going out TWICE every time the page loads. i panicked and added a flag so it only fetches once, and now sometimes the list doesn't show at all, which is worse lol. here's the code: import { useEffect, useState } from 'react' let hasFetched = false export default…
auto-fill vs auto-fit in css grid, i still dont get it
i have this card grid and i read like 4 articles and still cant tell what the difference is .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; } auto-fill and auto-fit look EXACTLY the same on my screen. when does it actually change something? feels like im missing something obvious
Frank from across town keeps telling me React 'is not a career'. So here's Fireship's 'React for the Haters in 100 Seconds'. Watched it twice. Still employed, still shipping. Lions kick off in an hour. 313 🦁
:has() en CSS: el selector padre que pedimos durante 20 años (y 6 cosas que ya hago con él)
Durante años la respuesta a "¿se puede seleccionar el padre en CSS?" fue "no, usa JavaScript". Ya no. :has() funciona en todos los navegadores modernos desde finales de 2023 (Firefox fue el último, en la versión 121) y yo ya lo uso en producción sin miedo. La idea: A:has(B) selecciona A si adentro tiene algo que cumpla B. Van mis usos favoritos: 1. Tarjetas con o sin imagen .card:has(img) { grid-template-rows: 180px…
useEffect no es para todo: 5 cosas que hacía mal y cómo las arreglé
Parce, hace un año revisé un proyecto mío viejo y conté 43 useEffect. Hoy tiene 9. Y funciona mejor. Les cuento los 5 errores que más cometía, por si se ven reflejados. 1. Estado derivado en un efecto // mal const [nombreCompleto, setNombreCompleto] = useState('') useEffect(() => { setNombreCompleto(nombre + ' ' + apellido) }, [nombre, apellido]) // bien const nombreCompleto = nombre + ' ' + apellido Si algo se…
typescript: whats the actual difference between `name?: string` and `name: string | undefined`?
my senior left a review comment "these are not the same thing" on this: type User = { name?: string } type User2 = { name: string | undefined } in my head both mean "name might be undefined". when i hover in vscode they look almost the same. whats the real difference and when would i pick one over the other? i googled and found something about exactOptionalPropertyTypes and now im more confused lol
react + typescript interview questions from my last 11 rounds (and what they were actually testing)
day 22 of the hunt. 11 rounds at 6 companies so far: 4 machine coding, 3 DSA (easy to medium), 2 frontend system design, 2 behavioural. here's what came up in the frontend rounds, and what i think each question was really testing. 1. "why does this effect run twice?" react 18 strict mode runs effects twice in development, on purpose, to catch effects that don't clean up after themselves. they are testing whether you…
why does my useEffect fetch run twice?? deps array is empty
ok this is probably dumb but i have been staring at it for an hour. i have a component that fetches the users orders when it mounts. deps array is empty so it should only run once right?? but in the network tab i see TWO requests every time useEffect(() => { fetch('/api/orders') .then((res) => res.json()) .then((data) => setOrders(data)) }, []) i console logged inside it and yep, runs twice. react 18 with vite. is…
Web Dev Roadmap 2026 para sa beginners (libre lahat, walang bootcamp)
Mga kapatid, ito na yung pinaka-hinihingi niyo sa comments ko for months. Yung roadmap na binibigay ko sa mga students ko, buo, libre. Hindi ito para maging "senior in 3 months". Ito ay para sa taong may trabaho o nag-aaral, may 2 oras kada araw, at gustong maging job-ready sa loob ng isang taon. (Goal desk. Hindi akin. Yung akin may electric fan at kapeng 3-in-1.) Phase 0: Setup (week 1) VS Code, Git, at isang…
my card looks fine on the page but gets squished in the sidebar?? do i need container queries
hi all 🦉 1am here, kids are asleep, coffee #3. building a recipe site for practice and i have a recipe card, image on the left and text on the right. on small screens it stacks. i did it with a media query like teh tutorial said: .card { display: flex; flex-direction: column; gap: 1rem; } @media (min-width: 600px) { .card { flex-direction: row; } } on the main page it looks great. but i also show the same card in…
Le build du thème et le bourguignon avaient le même temps de cuisson (j'ai fini par réparer les deux)
Petit retour d'expérience un peu idiot mais vrai. Depuis 2015 je fais des sites WordPress et WooCommerce pour des boulangeries, des vignerons du coin et des gens pressés. Je travaille de chez moi, à Nantes, et mon bureau est à trois mètres de la cuisine. Donc depuis des années j'ai une habitude : je lance le build du thème, et je vais touiller quelque chose. Le problème, c'est que mon build est devenu de plus en…
spent 3 hours centering a modal. chrome: perfect. firefox…
spent 3 hours centering a modal. chrome: perfect. firefox: perfect. safari on the CEO's iphone: la2 ya habibi. khalas I'm becoming a backend dev لا أحد يفهم سفاري
satisfies, NoInfer and the design system that stopped lying to us
Our design system has around 60 components, 4 brands, and one recurring bug class: a value that TypeScript said was fine and the UI said was not. Here are the three patterns that killed most of them. Nothing exotic, yani, but my team only believed me after seeing the errors. 1. Tokens: satisfies instead of an annotation We had this: const toneColors: Record<string, string> = { neutral: '#3f3f46', success: '#15803d',…
light don go at 98% of npm install. gen don finish fuel. na…
light don go at 98% of npm install. gen don finish fuel. na phone torch i dey use debug CSS now. if you see one typo for my PR tomorrow, na darkness cause am, no be me 😂
How to center a div: 5 methods, ranked by how much they made me cry
Everybody laughs at "how do I center a div" until they are the one at 11pm with a client on WhatsApp asking why the logo is "small small shifting to the left". I have been that person. So this is the post I wish I had when I started. The code is real and it works. The tears are also real. 5. position: absolute + transform (the old faithful) .parent { position: relative; } .child { position: absolute; top: 50%; left:…
Freelancing for Paris from Beirut: generator hours, a UPS and the bank that ate my savings
hi kifak, ça va? People ask how I work for French and German clients from here. Short answer: around the generator. Long answer below 🙃 Electricity. State power comes some hours a day, when it comes. The rest is the neighbourhood generator, the "ishtirak", a subscription you pay to a guy with a very big diesel engine and a very big network of cables over the street. It switches over a few times a day and every…
Bug of the week: date field only broken for Japanese users (and it was not timezone)
Hello everyone, first post here 🐞. I am QA in Hanoi, we test web app for one Japanese client and one Australian client. This week I found a bug that is so funny I want to share. Symptom: Japanese client say "birthday field always say Invalid date". Australian client no problem. Dev team test it, no problem. Of course "cannot reproduce" 😅 First everybody think timezone, because it is always timezone. Not timezone.…
Flexbox o Grid: cómo decido en 10 segundos (con el código que sí uso en la chamba)
Cada semana alguien en la chamba me pregunta "¿esto lo hago con flex o con grid?". La respuesta de libro es "flex para una dimensión, grid para dos". Está bien, pero a mí me sirve más esta otra: Si el contenido manda el tamaño, flex. Si el layout manda el tamaño, grid. O sea: con flex los elementos dicen "yo mido esto" y el contenedor se acomoda. Con grid el contenedor dice "aquí hay 3 columnas" y los elementos se…