Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remix-utils

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remix-utils - npm Package Compare versions

Comparing version 6.3.0 to 6.4.0

browser/react/server-only.d.ts

2

package.json
{
"name": "remix-utils",
"version": "6.3.0",
"version": "6.4.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "engines": {

@@ -159,2 +159,33 @@ # Remix Utils

### ServerOnly
The ServerOnly component is the opposite of the ClientOnly component, it lets you render the children element only on the server-side, avoiding rendering it the client-side.
You can provide a fallback component to be used on CSR, and while optional, it's highly recommended to provide one to avoid content layout shift issues, unless you only render visually hidden elements.
```tsx
import { ServerOnly } from "remix-utils";
export default function Component() {
return (
<ServerOnly fallback={<ComplexComponentNeedingBrowserEnvironment />}>
{() => <SimplerStaticVersion />}
</ServerOnly>
);
}
```
This component is handy to render some content only on the server-side, like a hidden input you can later use to know if JS has loaded.
Consider it like the `<noscript>` HTML tag but it can work even if JS failed to load but it's enabled on the browser.
The rendering flow will be:
- SSR: Always render the children.
- CSR First Render: Always render the children.
- CSR Update: Update to render the fallback component (if defined).
- CSR Future Renders: Always render the fallback component, don't bother to render the children.
This component uses the `useHydrated` hook internally.
### CORS

@@ -161,0 +192,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc