pbeshai / use-query-params

React Hook for managing state in URL query parameters with easy serialization.

Home Page:https://pbeshai.github.io/use-query-params

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React.useRef(undefined) returns { current: null } rather than { current: undefined }

RajaSK05 opened this issue · comments

image

In the above image, on line 77, the encodedValuesCacheRef is initialized with useRef(undefined). But if you see the executed value, { current: null } is returned rather than { current: undefined }.

This becomes an issue while executing the following if-check in getLatestDecodedValues function.

image

This results in returning an empty object as decodedValue on initial load from useQueryParams.

I'm using preact in my project and this is an issue in preact v10.4.7. Seems like it is fixed in v10.4.8. Closing this issue here.