explaingit

audemodo/audemodo-responsive-keepalive

Analysis updated 2026-05-18

28TypeScriptAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

A React library that keeps mobile and desktop component trees alive at the same time so user state (scroll position, form input, open menus) is never lost when the screen size changes.

Mindmap

mindmap
  root((responsive-keepalive))
    What it does
      Keep inactive layouts alive
      Preserve scroll and form state
      Anti-thrash delay
      IME-safe switching
    Tech Stack
      TypeScript
      React 19.2 Activity
      ResizeObserver
      ESM and CJS
    Use Cases
      Mobile-desktop state retention
      Container-level breakpoints
      Shared state across layouts
    Audience
      React developers
      Frontend engineers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a dashboard with distinct mobile and desktop layouts where tab selection and scroll position persist when the user resizes the window.

USE CASE 2

Create a search page that keeps the typed query alive when switching between mobile and desktop views without remounting.

USE CASE 3

Add container-level responsiveness to a card component so it rearranges itself based on its own width, not the viewport width.

What is it built with?

TypeScriptReact 19.2ResizeObserverESMCommonJS

How does it compare?

audemodo/audemodo-responsive-keepalivecahn91/gpt-repo-mcplsq128/miraframe
Stars282828
LanguageTypeScriptTypeScriptTypeScript
Setup difficultyeasymoderatehard
Complexity2/53/54/5
Audiencedevelopervibe codervibe coder

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Requires React 19.2 or newer as a peer dependency.

MIT license: use freely for any purpose, including commercial projects, as long as you keep the copyright notice.

In plain English

When a web app has completely different layouts for mobile and desktop, switching between them at a screen-size boundary usually wipes out whatever state the user had built up: scroll position, form text they typed, dropdown menus that were open. This happens because React unmounts one component tree and mounts another fresh. The responsive-keepalive library fixes that by keeping both trees alive simultaneously, using a React 19.2 feature called Activity to hide the inactive one rather than remove it from the page entirely. The library ships as an npm package and requires React 19.2 or newer as a peer dependency. Developers define breakpoints once, give each a name (for example mobile and desktop), and wrap their layouts with the provided Responsive component. When the screen size crosses a boundary, the active layout switches but neither layout loses its internal state. It falls back to a simpler swap-and-unmount strategy on older React versions. Beyond the core mobile-desktop case, the library also handles container-level responsiveness: a single card can watch its own width and rearrange itself independently of the viewport. This uses the browser's ResizeObserver API. There is also a useSharedState hook that lets two sibling layouts read and write the same value without passing it through a shared parent component. Two smaller quality-of-life features address common pain points with responsiveness: an anti-thrash setting that delays a switch until the screen size has been stable for a set number of milliseconds, and an IME-safe mode that holds off on switching while the user is typing with an input method editor, relevant for Chinese, Japanese, or Korean text entry. Both are optional and configured per hook call. The package has no runtime dependencies, works in server-side rendering environments, and ships in both ESM and CommonJS formats with TypeScript types included. It is released under the MIT license.

Copy-paste prompts

Prompt 1
Using @audemodo/responsive-keepalive with React 19.2, set up a Responsive component that shows MobileLayout below 768px and DesktopLayout above it, and confirm a counter value survives a resize.
Prompt 2
Show me how to use useContainerVariant from responsive-keepalive so a card switches from a stacked layout to a row layout when its own container exceeds 420px wide.
Prompt 3
How do I share a search query string between MobileSearchField and DesktopSearchField using useSharedState from responsive-keepalive without lifting state to a parent?
Prompt 4
Configure createResponsive with mobile, tablet, and desktop breakpoints and set settleMs to 150 so the layout does not switch until the resize has been stable for 150ms.

Frequently asked questions

What is audemodo-responsive-keepalive?

A React library that keeps mobile and desktop component trees alive at the same time so user state (scroll position, form input, open menus) is never lost when the screen size changes.

What language is audemodo-responsive-keepalive written in?

Mainly TypeScript. The stack also includes TypeScript, React 19.2, ResizeObserver.

What license does audemodo-responsive-keepalive use?

MIT license: use freely for any purpose, including commercial projects, as long as you keep the copyright notice.

How hard is audemodo-responsive-keepalive to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is audemodo-responsive-keepalive for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub audemodo on gitmyhub

Verify against the repo before relying on details.