(initialValue: T)
| 10 | * - A function to get the current value without causing re-renders (useful inside closures). |
| 11 | */ |
| 12 | export function useState<T>(initialValue: T): [() => T, (newValue: T) => void] { |
| 13 | let value = initialValue; |
| 14 | const getValue = () => value; |
| 15 | const setValue = (newValue: T) => { |
| 16 | value = newValue; |
| 17 | }; |
| 18 | return [getValue, setValue]; |
| 19 | } |
no outgoing calls
no test coverage detected