### What problem does this PR solve? feat: add CreateFlowModal #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@@ -244,3 +244,28 @@ export const useHandleMessageInputChange = () => {
|
||||
};
|
||||
|
||||
// #endregion
|
||||
|
||||
/**
|
||||
*
|
||||
* @param defaultId
|
||||
* used to switch between different items, similar to radio
|
||||
* @returns
|
||||
*/
|
||||
export const useSelectItem = (defaultId?: string) => {
|
||||
const [selectedId, setSelectedId] = useState('');
|
||||
|
||||
const handleItemClick = useCallback(
|
||||
(id: string) => () => {
|
||||
setSelectedId(id);
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (defaultId) {
|
||||
setSelectedId(defaultId);
|
||||
}
|
||||
}, [defaultId]);
|
||||
|
||||
return { selectedId, handleItemClick };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user