
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
react-use-dock
Advanced tools
(requires React version ^16.8.0)
# npm
npm i react-use-dock
# Yarn
yarn add react-use-dock
Wrap application with
DockProvider
import { DockProvider } from 'react-use-dock'
function MyApp() {
return (
<DockProvider>
<Layout>
<AppContent />
</Layout>
</DockProvider>
)
}
Add
Dockcomponent into your component tree
import { Dock } from 'react-use-dock'
function Layout({ children }) {
return (
<div>
<header>
<h1>React Use Dock</h1>
</header>
<main>{children}</main>
<footer>Stuff</footer>
{/* Dock is absolutely positioned, place anywhere */}
<Dock />
</div>
)
}
Use Dock
import { useEffect } from 'react'
import { useDock, DockContainer } from 'react-use-dock'
function Example() {
const dock = useDock()
// provide any render function!
const render = () => (
<DockContainer onCloseDock={() => console.log('Closed dock')}>
<YourDockContent />
</DockContainer>
)
useEffect(() => {
dock.openDock({
render,
minSize: 350,
orientation: 'right',
size: 50,
})
}, [])
return (
<div>
<button onClick={dock.toggleDock}>Toggle Dock</button>
</div>
)
}
useDock hook
View the useDock() api in the Docs
Dock
The Dock component is where the render function is called to display content.
interface DockProps {
id?: string
style?: React.CSSProperties
}
| Name | Description | Default |
|---|---|---|
| id | id attribute for the Docks <div>. Useful for css selection | react-use-dock |
| style | Inline styles | {} |
DockContainer
The DockContainer component is a simple wrapper component that renders a close icon at the top right.
interface DockContainerProps {
children: any
onCloseDock?(): void
CloseIcon?: ReactNode
}
| Name | Description | Default |
|---|---|---|
| children | React child components | - |
| onCloseDock | Callback when dock is closed | () => {} |
| CloseIcon | Custom React component for close icon | <span style={{ fontSize: '1.5em' }}>×</span> |
import { DockContainer } from 'react-use-dock'
function Example() {
return (
<DockContainer
onCloseDock={() => console.log('Closed Dock')}
CloseIcon={<span>Close Dock</span>}
>
<YourDockContent />
</DockContainer>
)
}
FAQs
A hook to render dynamic content into a Dock
The npm package react-use-dock receives a total of 1 weekly downloads. As such, react-use-dock popularity was classified as not popular.
We found that react-use-dock 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
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.