NoBind
No more `bind` in JSX
Install / Use
/learn @RamonGebben/NoBindREADME
noBind
No more bind in JSX.
Motivation
The reason why I started building this little utility was lead by one of the rules applied in the React eslint config of Airbnb.
There they point out that when using .bind inside of your render method will make the amount of memory used by your app bigger with each "rerender".
This is because .bind return a copy of the that bound function. This utility gives you the same behavior as .bind would without making a copy of your function. As so be more memory efficient.
Usage
import noBind from 'no-bind';
function clickHandler(id, e) {
console.log(id, e);
}
function MyList(props) {
const { listItems } = props;
return listItems.map(item => (
<button onClick={noBind(clickHandler, item.id)}>
Click Me
</button>
))
}
Related Skills
node-connect
345.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
106.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
