diff --git a/lib/use-hash-state.js b/lib/use-hash-state.js index dbc8c979..7f8d1438 100644 --- a/lib/use-hash-state.js +++ b/lib/use-hash-state.js @@ -41,7 +41,7 @@ export const useHashState = (initial, param, { suffix = '', read, write, multi } const [link, parseHash] = multi ? [multiLink, multiParse] : [singleLink, singleParse], [state, _setState] = useState(() => param == null - ? initial + ? read(initial) : parseHash(param + suffix, read) ?? initial), setState = useCallback(state => _setState(oldState => {