惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
Martin Fowler
Martin Fowler
I
InfoQ
腾讯CDC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
爱范儿
爱范儿
Microsoft Security Blog
Microsoft Security Blog
Google DeepMind News
Google DeepMind News
D
DataBreaches.Net
云风的 BLOG
云风的 BLOG
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
博客园 - 聂微东
Microsoft Azure Blog
Microsoft Azure Blog
D
Docker
博客园 - 三生石上(FineUI控件)
Y
Y Combinator Blog
博客园 - Franky
Engineering at Meta
Engineering at Meta
B
Blog
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
Jina AI
Jina AI
V
Visual Studio Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
What Building Pagelyze Taught Me About React Best Practices
Prazin Karki · 2026-06-26 · via DEV Community

Prazin Karki

What building Pagelyze taught me about React best practices - and why it has very little to do with hooks.

Building Pagelyze has made me think more carefully about React best practices, not as theory, but as product architecture.

I already work across Vue, Nuxt, Laravel, CMS platforms, and analytics. But React is a skill I want to sharpen properly, especially while building my own product, Pagelyze (a website audit and lead-check tool), under PKTechie.

Pagelyze isn't a toy app with a few components. It has real product concerns: audit reports, scoring logic, lead-flow evidence, dashboards, and paid-conversion paths. So while relearning React, I kept asking one practical question:

Can the code stay clean while the product gets more useful?

Good React isn't just about hooks

useState, useEffect, useMemo, custom hooks - important, but not the full story. A React app can use modern syntax everywhere and still be miserable to maintain. The real issue is rarely syntax. It's whether each piece of code has a clear responsibility.

Component responsibility matters early

In Pagelyze, an audit report screen could easily turn into one giant file handling everything from loading data to deciding which service to recommend. It would work for a while - it wouldn't scale.

A cleaner split:

<AuditSummary />
<LeadCheckPanel />
<EvidenceList />
<ServiceRecommendationCard />
<ReportActions />

Each component has one clear reason to exist - so I can improve Lead Rescue without touching SEO scoring, or redesign a card without rewriting data logic.

State should live where it makes sense

The better question isn't "Redux or Context?" - it's who actually needs this state?

Local UI state:    tabs, toggles, modals, expanded panels
Form state:        audit URL, validation, submission status
Server state:      audit reports, scans, saved results
Global state:      user, organisation, plan, permissions

Hooks should extract meaning, not hide mess

A custom hook should represent a meaningful piece of behaviour, not just relocate messy code:

const { report, isLoading, error } = useAuditReport(reportId)

function AuditReportPage({ reportId }: { reportId: string }) {
  const { report, isLoading, error } = useAuditReport(reportId)

  if (isLoading) return <ReportLoadingState />
  if (error) return <ReportErrorState />

  return (
    <ReportLayout>
      <AuditSummary report={report} />
      <LeadCheckPanel leadCheck={report.leadCheck} />
      <RecommendedFixes report={report} />
    </ReportLayout>
  )
}

The page only coordinates the screen - that's enough.

Structure the project around the product, not the framework

features/
  audit-report/
    components/
    hooks/
    types.ts
  lead-rescue/
    components/
    evidence/
    manual-proof/
  dashboard/
    components/
    hooks/

Routing is part of conversion

For Pagelyze, routing is not just URLs. It is the user journey from the first landing page visit to a clear service enquiry:

Landing page
  ↓
Free audit
  ↓
Report result
  ↓
Lead-check explanation
  ↓
Recommended fix
  ↓
Service enquiry

Good routing guides them to the next step.

Measure performance - don't guess it

Build clearly. Measure honestly. Find the actual bottleneck. Optimise that specific thing.

Security is front-end work too

The rule I keep coming back to: don't expose anything in the browser that shouldn't be public.

The takeaway

React best practices are really about decision-making - what each component owns, where state lives, whether a route helps the user move forward, and whether the app is safe and fast in real use.

Pagelyze is my real test: not whether I can build a screen, but whether I can keep the product clean and maintainable as it gets more serious.


Originally published on PKTechie.