Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
react-client-only
Advanced tools
This package provides a utility component and a React hook for only rendering React components in the browser, but not during server-side rendering.
This is useful for static-side generation when trying to avoid rehydration issues, e.g. for components dependent on the current user.
Inspired & based on the examples in this blog post.
import React from "react";
import { ClientOnly, useClientOnly } from "react-client-only";
const component = () => (
<div>
<p>This will render during SSR and on the client.</p>
<ClientOnly>
<p>This will render on the client only.</p>
</ClientOnly>
</div>
);
// or
const component2 = () => {
const isOnClient = useClientOnly();
if (!isOnClient) {
return null;
}
return <p>This will render on the client only.</p>;
};
# If you're using yarn
yarn add react-client-only
# If you're npm
npm install react-client-only
FAQs
Helpers to only render React components in a browser (not SSR)
We found that react-client-only demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.