想做一个小程序
目前处于规划阶段,功能包括:
房间组队、位置共享、路线协作、行程进度、美图归集、权限管理。
主打:简单、好用、隐私安全。
求各位大佬给点建议:功能怎么砍?技术栈怎么选?体验怎么优化?
单个 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;
};
```
```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;
};
```
展开
评论
5