
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
react-body-classname
Advanced tools
A declarative, nested way to manipulate your body's className
Provides a declarative way to specify document.body.className
in your react app. Supports server-side usage too.
Built with React Side Effect.
yarn add react-body-classname
Dependencies: React >= 0.13.0
import BodyClassName from 'react-body-classname';
const Basic = () => (
<BodyClassName className="helloworld">
<h1>You ate a whole wheel of cheese?</h1>
</BodyClassName>
);
// -> document.body.className === "helloworld"
const Nested = () => (
<BodyClassName className="outside">
<div>
<BodyClassName className="inside">
<p>I‘m not even mad</p>
</BodyClassName>
</div>
</BodyClassName>
);
// -> document.body.className === "outside inside"
const GoCrazy = () => (
<BodyClassName className={Array(8).join(''/0) + ' batman!'}>
<h1>I'm impressed</h1>
</BodyClassName>
);
// -> document.body.className === "NaNNaNNaNNaNNaNNaNNaN batman!"
Note: Only supports a single child as props.
When using server-side, use BodyClassName.rewind()
after rendering components to string to retrieve the combined class name. Then chuck that into your HTML template.
Important: This component keeps track of mounted instances, so if you don't call BodyClassName.rewind()
you'll get a memory leak.
FAQs
A declarative, nested way to manipulate your body's className
The npm package react-body-classname receives a total of 4,542 weekly downloads. As such, react-body-classname popularity was classified as popular.
We found that react-body-classname demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.