Open-source project
jaredpalmer/the-platform avatar
jaredpalmer/the-platform

The Platform wraps browser Web APIs in React Hooks and Suspense components

GitHub describes it as Web. Components. 😂. The repository metadata lists TypeScript as its primary language. The metadata lists the MIT license. This article stays within the project description and details documented in the GitHub repository README.

4,368 stars105 forksTypeScriptMIT

At a glance

What is it?
jaredpalmer/the-platform turns device sensors, media queries, scroll offsets and remote scripts into React hooks and Suspense-ready components. It is a tidy 2019-era idea, and its peer dependencies on react-cache pin it to a React that no longer ships that way.
Who is it for?
Adopt The Platform if you are already on React 16.8, have a suspended data loading layer, and want device motion, media queries and remote script loading behind a single import rather than a folder of addEventListener effects. Do not adopt it for a new project. peerDependencies pins react-cache at ^2.0.0-alpha.1, an alpha that a current React tree will not resolve, and the code on master is newer than the published 0.10.1 build.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Probably not. The repository last received commits 47 months ago, on December 9, 2022.
What is it written in?
Mainly TypeScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • jaredpalmer/the-platform4,368 ★ · -1
Star history
Repository2026-08-132026-11-15
jaredpalmer/the-platform4.4k4.4k

-1 Stars in the last 94 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Every browser capability arrives as a hook that reads window

The Platform does one thing: it wraps browser APIs that would otherwise need an effect, a listener and a piece of component state into named hooks. useWindowSize returns width and height taken straight from window.innerWidth and window.innerHeight. useWindowScrollPosition returns x and y from window.pageXOffset and window.pageYOffset. useNetworkStatus returns isOnline plus an optional offlineAt date, so a component can tell the user when the connection dropped rather than only whether it is present right now.

The sensor hooks go further out. useDeviceMotion destructures acceleration, rotationRate and interval, the same fields a DeviceMotionEvent carries. useDeviceOrientation returns alpha, beta, gamma and absolute. useGeoPosition throws a promise and must be used with Suspense, which puts it in a different class from the resize and scroll hooks that return synchronously.

For a React developer who has written the same addEventListener and setState pair three times, that split is the argument. You import one function and get a value. The library is TypeScript, built with Babel and tested with Jest.

Two hook families: plain reads and promise throwers

The API divides cleanly by return type, and knowing which is which decides where a hook can live in your tree.

Read synchronously: useWindowSize, useWindowScrollPosition, useNetworkStatus, useDeviceMotion, useDeviceOrientation, useMedia. These return a value on the first render and update through the browser's own events.

Throw a promise: useGeoPosition, useScript, useStylesheet. useScript takes a src and useStylesheet an href, while useGeoPosition takes PositionOptions. The README states the requirement plainly for all three: "This will throw a promise (must use with Suspense)." There is no isLoaded flag and no fallback argument. Wrap the caller in a React.Suspense boundary with maxDuration set to 300 and a fallback string, exactly as the component examples do, or the render will stall.

useMedia accepts an object and hands it to json2mq

useMedia takes either a query string or a plain object, and it returns a single boolean named match. The object form is the interesting one, because it is parsed by json2mq, the library's only runtime dependency at ^0.2.0.

The string form is the query you would hand to window.matchMedia directly. The object form takes camel-cased keys such as minWidth and produces the query string for you, so you can build a query from a numeric prop without string concatenation at every call site. A defaultMatches boolean supplies the value returned before the browser has answered, which is the closest thing here to server-side rendering support: without it, a component that reads match on the server has no correct value to report.

There is no subscription option in the signature. Whatever the hook does internally, the documented contract is a boolean out, so if you need per-breakpoint callbacks rather than a re-render, this is the wrong hook.

Install, then render the first suspended script

Installation is a single dependency. React 16.8 or newer is required for Hooks, and the README flags that as a note above the install commands.

sh
npm i the-platform --save

The package name on npm is the-platform. Peer dependencies in package.json ask for react >=16.6.0, react-dom >=16.6.0 and react-cache ^2.0.0-alpha.1. If your lockfile has no react-cache, installing is where you find out.

First use is a script tag that renders its children only after load. The children prop is a render prop, and the README notes it executes after the script has loaded:

js
import React from 'react';
import { Script } from 'the-platform';

function App() {
  return (
    <div>
      <h1>Load Stripe.js Async</h1>
      <React.Suspense maxDuration={300} fallback={'loading...'}>
        <Script src="https://js.stripe.com/v3/" async>
          {() => console.log(window.Stripe) || null}
        </Script>
      </React.Suspense>
    </div>
  );
}

Swap the src for your own bundle. Anything else you can pass to a script tag is forwarded, so async stays async.

Img, Video and Audio are the same wrapper with a different tag

The five components are not five ideas. Img, Video, Audio and Script each take a src, take anything else their native tag accepts, and suspend until the browser signals the resource is ready; Stylesheet is the fifth. Preload exists as a separate component for hinting.

That sameness cuts both ways. Video passes through preload="auto" and autoPlay to the video tag, and Audio does the same, so you keep the browser's own buffering behaviour instead of getting a custom player.

The examples linked from the README are CodeSandbox sandboxes: a basics one, a low quality image placeholder, and the Stripe Checkout script.

react-cache ^2.0.0-alpha.1 is the dependency that dates this library

Look at peerDependencies rather than the README's cheerful install heading. The library requires react-cache at ^2.0.0-alpha.1, a prerelease package from the era when React's data-fetching story was still being designed. The alpha that this package pins to is not what a current React tree resolves.

A second detail only a skim misses: the repository field in package.json reads palmerhq/the-platform, while the project lives under jaredpalmer. The npm metadata and the GitHub path disagree, so tooling that derives a repository URL from package.json will point at palmerhq rather than jaredpalmer. Check the repository field yourself before wiring up links.

The last push to the repository was on 2022-12-09, and no release has been published since 0.10.1 came out in 2019. Code landed on master for years after the registry build was cut, so what you install from npm is older than the code in the repository.

Where react-hooks libraries and your own hook file differ

Write these hooks yourself and you get roughly a hundred lines of effects and listeners in one file inside your own repository, with types you control and no peer dependencies. The Platform's claim is not capability but deletion: the events, cleanup functions and resize handling are already written, and the Suspense variants would otherwise mean hand-rolling promise throwing.

That trade is worth taking when the hooks you actually need are the throwing ones. useScript and useStylesheet encode a resource loading pattern that is fiddly to get right, and the render prop on Script gives you a callback that fires after load with no manual state.

It is worth less when you need one sensor hook. Reaching for a package with an alpha peer dependency to avoid twenty lines of addEventListener is a bad trade. The alternative here is not a competing library but your own src/hooks file, which has zero install cost and zero resolution risk.

Writing the hooks yourself keeps the licence question off the table entirely.

Editorial conclusion

Adopt The Platform if you are already on React 16.8, have a suspended data loading layer, and want device motion, media queries and remote script loading behind a single import rather than a folder of addEventListener effects. Do not adopt it for a new project. peerDependencies pins react-cache at ^2.0.0-alpha.1, an alpha that a current React tree will not resolve, and the code on master is newer than the published 0.10.1 build. Verify first that your bundler can resolve react-cache at all: useScript, useStylesheet and useGeoPosition throw promises, so a failed resolution removes the fallback path instead of degrading to a placeholder. Read package.json yourself too, since its repository field names palmerhq rather than jaredpalmer.

Frequently asked questions

How do I install The Platform for React?

Run npm i the-platform --save, or yarn add the-platform. The README states that React 16.8 or newer is required, since earlier versions have no Hooks.

Which The Platform hooks require a Suspense boundary?

useGeoPosition, useScript and useStylesheet each throw a promise and the README says they must be used with Suspense. The other hooks, including useWindowSize and useMedia, return a value synchronously.

Can useMedia take a JavaScript object instead of a query string?

Yes. The query argument accepts a string or an object, and the object form is parsed by json2mq. An optional defaultMatches boolean supplies the value before the browser has answered.

Does The Platform work with the current version of React?

Its peerDependencies require react-cache at ^2.0.0-alpha.1, an alpha release. The package metadata was published as version 0.10.1 in April 2019.

What does The Platform's Script component do with its children?

The children prop is a render prop, and it only executes after the script has loaded. Other props are forwarded to the script tag, so async and similar attributes still work.

Official sources

  1. Official README
  2. Project repository
  3. Release notes
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/jaredpalmer-the-platform.svg)](https://hysenlabs.com/projects/jaredpalmer-the-platform)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/jaredpalmer-the-platform.svg)](https://hysenlabs.com/projects/jaredpalmer-the-platform)

Was this useful?