
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
@render-props/click
Advanced tools
A state container which provides an interface for targeting specific types of click events (e.g. double-click) and extracting rich stats about click position within the client, window, etc. making it perfect for UX analytics work.
A state container which provides an interface for targeting specific types of click events (e.g. double-click) and extracting rich stats about click position within the client, window, etc. making it perfect for UX analytics work.
The component will only update its state if all of the conditions specified in props are met.
yarn add @render-props/clickable
or npm i @render-props/clickable
import Click from '@render-props/click'
const ButtonClick = props => (
<Click double left>
{
({
clickRef,
numClicks,
screenX,
screenY,
clientX,
clientY,
elementX,
elementY,
rectX,
rectY
}) => (
<button ref={clickRef}>
Clicked: {numClicks} times at
<br/>
{`{clientX: ${clientX}, clientY: ${clientY}}`}
<br/>
{`{screenX: ${screenX}, screenY: ${screenY}}`}
<br/>
{`{elementX: ${elementX}, elementY: ${elementY}}`}
</button>
)
}
</Click>
)
The props for this component are conditions to meet when you want the state
to update. So if you only want to track double clicks, you'd set double={true}
.
All conditions in props must be satisfied for a click to start a state update. If
no props are provided, all events trigger an update.
clickTypes {array}
detail=1
event.detail === 1
shiftKey
event.shiftKey === true
shiftKey+metaKey
event.shiftKey === true && event.metaKey === true
shiftKey|metaKey+detail=1
event.shiftKey === true || event.metaKey === true && detail === 1
single {bool}
e.detail === 1
double {bool}
e.detail === 2
triple {bool}
e.detail === 3
left {bool}
e.button === 0
middle {bool}
e.button === 1
right {bool}
e.button === 2
shift {bool}
e.shiftKey === true
control {bool}
e.ctrlKey === true
meta {bool}
e.metaKey === true
alt {bool}
e.altKey === true
altMeta {bool}
e.altKey === true && e.metaKey === true
altShift {bool}
e.altKey === true && e.shiftKey === true
controlAlt {bool}
e.altKey === true && e.ctrlKey === true
controlShift {bool}
e.ctrlKey === true && e.shiftKey === true
controlMeta {bool}
e.ctrlKey === true && e.metaKey === true
metaShift {bool}
e.shiftKey === true && e.metaKey === true
controlOrMeta {bool}
e.ctrlKey === true || e.metaKey === true
preventDefault {bool}
preventDefault()
on the event when clickedonClick {function}
(nextState <object>, event <Event>)
.clickRef
ref
must be provided to whatever element you are trying to observe the
the click of. e.g. <button ref={clickRef}>
numClicks {integer}
screenX {integer}
x
position of the click in relation to the screenscreenY {integer}
y
position of the click in relation to the screenclientX {integer}
x
position of the click in relation to the clientclientY {integer}
y
position of the click in relation to the clientelementX {integer}
x
position of the click in relation to the element's DOMRect
elementY {integer}
y
position of the click in relation to the element's DOMRect
rectX {integer}
x
coordinate of DOMRect
for the elementrectY {integer}
y
coordinate of DOMRect
for the elementFAQs
A state container which provides an interface for targeting specific types of click events (e.g. double-click) and extracting rich stats about click position within the client, window, etc. making it perfect for UX analytics work.
The npm package @render-props/click receives a total of 1 weekly downloads. As such, @render-props/click popularity was classified as not popular.
We found that @render-props/click 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.