Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
react-eventist
Advanced tools
Attach pre/post async actions to React event handlers.
react-eventist is only distributed as a CommonJS module and requires React 0.14 or later.
npm i --save react-eventist
<Eventist pre post>
Makes the specified pre
and post
functions available to the
connectEventist
calls.
pre
/post
([event], [props], [next])
The pre
/post
props are collections of functions that receive the handled
event
, wrapped components props
, and a next
function. The next
function
is called to move to the next action if available or to enter/exit the handler
if no intermediate steps remain.
pre
- Array<Function>
- Array of functions called before the event
handler is called.post
- Array<Function>
- Array of functions called after the event
handler is called.import { Eventist } from 'react-eventist'
const pre = [(event, props, next) => { console.log('before'); next(); }];
const post = [(event, props, next) => { console.log('after'); next(); }];
ReactDOM.render(
<Eventist pre={pre} post={post}>
<App />
</Eventist>
)
createEventist([eventistKey])
Creates an Eventist
component with a unique eventistKey
to allow for
secondary Eventist
providers.
eventistKey
- String
- Unique key to be used to provide and receive
the pre
/post
actions.import { createEventist } from 'react-eventist'
const HistoryEventist = createEventist('history')
const post = [(event, props, next) => { console.log('redirecting'); next() }];
ReactDOM.render(
<HistoryEventist post={post}>
<App />
</HistoryEventist>
)
connectEventist([component], [handler], [options])
Connects a component to the Eventist
provider and runs all pre
/post
functions on the specified handler
. Allows for a custom eventistKey
to be
provided through the options
;
It also provides an inProgress
prop to the wrapped component (can be changed
through the mapInProgressToProps
option) that specifies if the component is
in any pre
/post
actions.
options
eventistKey
- String?
- Optional key to connect to a custom Eventist
Provider.mapInProgressToProps
- Function?
- Optional function to map the inPre
,
inEvent
and inPost
state values to a prop for the wrapped component.import { connectEventist } from 'react-eventist'
const RouteButton = ({ onClick, inProgress }) =>
<button type="button" onClick={onClick} disabled={inProgress}>
Click
</button>
export default connectEventist(RouteButton, 'onClick')
MIT
FAQs
Perform pre/post actions on event handlers
The npm package react-eventist receives a total of 1 weekly downloads. As such, react-eventist popularity was classified as not popular.
We found that react-eventist 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.