🪝
React hooks
Evt let you work with events in react without having to worry about cleaning up afterward.
Basic example
Creating Evt from DOM Elements
The core idea is to always use the
ctx
to attach handlers. This will enable EVT to detach/reload handlers when they need to be namely when the component is unmounted or a value used in a handler has changed. With StatefulEvt
//package.json (if you use create-react-app otherwise use .eslintrc.js)
{
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
],
"rules": {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": [
"error",
{
"additionalHooks": "(useEvt)"
}
]
}
}
}
Last modified 10mo ago