File indexing completed on 2025-01-26 05:28:00

0001 import { useState } from 'react'
0002 
0003 const useMergeState = (initial = {}) => {
0004   const [state, set] = useState(initial)
0005   return {
0006     state,
0007     set: updater => set(prev => (typeof updater === 'function'
0008       ? { ...prev, ...updater(prev) }
0009       : { ...prev, ...updater })),
0010   }
0011 }
0012 
0013 export default useMergeState