M4RKYU.SYSEdition 2027
Skip to content
LOCZH/安大略 · 加拿大/▸logs · premium micro interactions in react 19 without the jank 230b待机OK/--:--:--EST
M4M4RK_YUportfolio
  • 创作创作
    创作Overview
    • 作品精选案例与项目记录
    • 游戏可玩原型与游戏开发日志
  • 影像影像
    影像Overview
    • 照片影像合集与视觉实验
    • 商店印刷品、海报和限量物件
  • 写作写作
    写作Overview
    • 博客长篇开发日志与现场笔记
    • 笔记短观察、链接与代码片段
  • 资源资源
    资源Overview
    • 工具38 款浏览器内开发工具
    • 链接每日使用的开发与设计书签
  • 关于关于
  • 联系联系
EN

同步 · dev.to / @markyu

React 19 Micro-Interactions Without Layout Jank

A practical React 19 micro-interactions guide focused on motion boundaries, CSS transitions, optimistic UI, reduced motion, and performance.

发布日期
Jun 4
·
阅读时长
2 min read
·
点赞
5
reactfrontendperformanceux
在 dev.to 查看

本页目录

  • Start With the Cheapest Interaction
  • Avoid Animating Layout
  • Optimistic Feedback
  • Respect Reduced Motion
  • My Interaction Checklist
  • React 19 Angle
  • Final Thought

Micro-interactions are easy to overdo.

The good ones make the UI feel responsive. The bad ones delay the user, shift layout, or turn every click into a tiny fireworks show.

My rule is simple:

Animate feedback, not uncertainty.

Start With the Cheapest Interaction

For a button, CSS is enough:

export function SaveButton({ saving }) {
  return (
    <button className="save-button" disabled={saving}>
      {saving ? "Saving..." : "Save changes"}
    </button>
  );
}
.save-button {
  transform: translateY(0);
  transition:
    transform 140ms ease,
    background-color 140ms ease,
    box-shadow 140ms ease;
}

.save-button:hover {
  transform: translateY(-1px);
}

.save-button:active {
  transform: translateY(0);
}

No layout properties. No JavaScript animation. No drama.

Avoid Animating Layout

Prefer:

  • transform
  • opacity
  • color
  • shadow, carefully

Be careful with:

  • height
  • width
  • top
  • left
  • margin

Those can trigger layout work and make the UI feel janky.

Optimistic Feedback

For React apps, many interactions feel better when the UI responds before the server round trip finishes.

function LikeButton({ initialLiked }) {
  const [liked, setLiked] = useState(initialLiked);
  const [pending, setPending] = useState(false);

  async function toggle() {
    const next = !liked;
    setLiked(next);
    setPending(true);

    try {
      await fetch("/api/like", {
        method: "POST",
        body: JSON.stringify({ liked: next }),
      });
    } catch {
      setLiked(!next);
    } finally {
      setPending(false);
    }
  }

  return (
    <button className={liked ? "liked" : ""} onClick={toggle} disabled={pending}>
      {liked ? "Liked" : "Like"}
    </button>
  );
}

The important part is rollback. Optimistic UI without rollback is just lying with confidence.

Respect Reduced Motion

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

I usually scope this more carefully in production, but the principle matters: motion should not be forced.

My Interaction Checklist

QuestionIf no
Does it communicate state?remove it
Does it keep layout stable?redesign it
Does it work with keyboard?fix focus state
Does it respect reduced motion?add fallback
Does it still feel fast on low-end devices?simplify

React 19 Angle

React 19 makes async UI patterns cleaner, but it does not automatically make motion good.

Use React for state and transitions. Use CSS for simple visual feedback. Reach for animation libraries only when the interaction is complex enough to justify them.

Final Thought

Premium UI is not about more animation. It is about the interface responding at the exact moment the user expects it to.

Which micro-interaction in a product made the UI feel genuinely better to you?

相关阅读

React Loading Screens Are a State Machine Problem

A practical React loading screen guide using hooks, request states, error states, CSS animation, and why spinners alone are not enough.

react

Next.js Images Without CLS: My LQIP Blur-Up Setup

A practical Next.js image optimization guide for zero CLS layouts, blur placeholders, dimensions, remote images, and production image hygiene.

nextjs

Java BeanUtils Copying: Convenient, but Not Free

A practical Java guide to BeanUtils, shallow copy pitfalls, reflection overhead, and when MapStruct or manual mapping is a better choice.

java

原文发布

本文首发于 dev.to,评论与点赞保留在原站。

在 dev.to 继续阅读
上一篇Free 3D Asset Sites I’d Actually Use in a WebGL ProjectA practical 2026 guide to free 3D asset sources for games, Blender, and WebGL, with license checks, optimization tips, and production workflow advice.
返回全部文章
下一篇JS Sorting Algorithms Every Developer Should KnowYou call .sort() every day without thinking about it. But the sorting algorithm your language's...
返回档案
M4RKYUM4RKYUM4RKYUM4RKYUM4RKYUM4RKYUM4RKYUM4RKYU
始于 2024
ZhenXiao Mark YuZhenXiao Mark Yu
联系

看到什么有意思的?和我聊聊。

这是一个作品集,不是服务 · 但每一条留言我都会看 — 如果哪里让你有所触动,或者只想打个招呼,欢迎写信过来。

开启对话
频道开放

随时打个招呼 · 2026

--:--:--EST加拿大 安大略
  • 邮件
  • GitHub
  • dev.to
  • 领英
  • 推特 / X
  • Instagram
  • Facebook
  • YouTube
  • CodePen
  • Spotify
  • Snapchat

订阅

偶尔收到一封简讯

来自 m4rkyu.com 的笔记与日志——简短、标注日期、没有杂音。随时可退订。

作品

线上发布、游戏作品与视觉档案。

  • 项目
  • 游戏
  • 档案
  • 日志

资源

每日好用的工具与个人收藏的链接库。

  • 搜索
  • 最新
  • 工具
  • 链接
  • 笔记
  • 主题
  • 商店
RSSJSON Feed

工作室

背景、联系方式以及合作渠道。

  • 关于
  • 联系
  • 更新日志
  • 技术说明
  • 简历筹备中

社交

在常去的平台上找到我。

  • GitHub
  • dev.to
  • 领英
  • 推特 / X
  • Instagram
  • Facebook
  • YouTube
  • CodePen
  • Spotify
  • Snapchat
  • 邮件
© 2026 ZhenXiao Mark Yumarkyu0615@gmail.com
  • 邮件
  • GitHub
  • dev.to
  • 领英
  • 推特 / X
  • Instagram
  • Facebook
  • YouTube
  • CodePen
  • Spotify
  • Snapchat
隐私条款由 Next.js 16 · React 19 · Tailwind 4 构建