获得徽章 0
单个 Input 没必要用 form 包裹
```ts
const useEnterCallback = (callback) => {
const inputRef = useRef(null);

useEffect(() => {
const handleKeyPress = (event) => {
if (event.key === 'Enter') {
callback(inputRef.current.value);
}
};
inputRef.current.addEventListener('keydown', handleKeyPress);
return () => {
inputRef.current.removeEventListener('keydown', handleKeyPress);
};
}, [callback]);

return inputRef;
};
```
展开
评论
github.com
抽离了调试器的 Sensors Orientation,终于可以自定义了[阴险]
1
下一页
个人成就
文章被点赞 123
文章被阅读 59,245
掘力值 1,260
收藏集
53
关注标签
58
加入于