Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
react-custom-portal
Advanced tools
renders part of your component markup outside in some another place
This helps you if you want to render part of your component markup in some another place. It's a bit like html portal in react, but for general react markup.
import { createPortal } from 'react-custom-portal'
const ExternalMarkup = createPortal()
const MyComponent = () => {
<SomeMarkup>
...
<ExternalMarkup.Content>
This text will not be rendered here,
but instead it will be rendered within ExternalMarkup.Render
</ExternalMarkup.Content>
...
</SomeMarkup>
}
const MySettings = () => {
<AnotherMarkup>
...
{/* The content of <ExternalMarkup.Content ... /> will be rendered here */}
<ExternalMarkup.Render />
...
</AnotherMarkup>
}
const MyPage = () => {
<ExternalMarkup.Root>
...
<MyComponent />
...
<MySettings />
...
</ExternalMarkup.Root>
}
By default <Portal.Render /> will render the content of all the <Portal.Content />s been rendered within the <Portal.Root />. If you want to tweak some things you can pass a function as the only child of <Portal.Render /> and it will be passed an array of <Portal.Content />s.
...
<ExternalMarkup.Content shape="circle" ... />
...
<ExternalMarkup.Content shape="rectangle" ... />
...
<ExternalMarkup.Render>
{children => children.filter(child => child.props.shape === "rectangle")}
</ExternalMarkup.Render>
...
createPortal
can be passed an options object with displayName
prop to tune the names of created components for debug purpose.
const Objects3DSettings = createPortal({ displayName: "Objects3DSettings" })
// now react tools displays "Objects3DSettings.Content" for <Objects3DSettings.Content ... /> instead of "Portal.Content"
FAQs
renders part of your component markup outside in some another place
The npm package react-custom-portal receives a total of 2 weekly downloads. As such, react-custom-portal popularity was classified as not popular.
We found that react-custom-portal 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.