You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Step one: a minor release that introduces useLatestRef
In a minor release to this library, introduce useLatestRef as an alias to useLatest. Update the docs to describe useLatestRef as the recommended alias of useLatest.
Step two: a major release that deprecates useLatest
In the next major release, deprecate useLatest. Remove it from the docs (or mark it as deprecated in the docs), but keep it in the code and add a dev mode warning:
if(process.env.NODE_ENV!=='production'){// Just an example msg lolconsole.warn('useLatest is deprecated and will be removed in the next major release. Please import useLatestRef instead.');}
(you would want to cache the message so it only logs one time, like React logs)
Step three: another major release that removes useLatest
A long time from now, you cut a 2nd major release that removes useLatest altogether.
Is it worth the effort? idk, what do you think?
The text was updated successfully, but these errors were encountered:
Incredible PR, @pastelmind ! The version of useLayoutRef that you’ve PR’d is actually what I use in my own apps, as I prefer to follow the React best practices that you mentioned.
Is your feature request related to a problem? Please describe.
The name
useLatest
does not indicate that it returns a ref.Describe the solution you'd like
Rename
useLatest
touseLatestRef
.Describe alternatives you've considered
Leave the name as is.
Migration Path Considerations
This is a Big Breaking Change© and could cause a lot of frustration. Likely more frustration than it's worth if
useLatest
just vanishes one day. But I think it's doable in a way that minimizes frustration:Step one: a minor release that introduces
useLatestRef
In a minor release to this library, introduce
useLatestRef
as an alias touseLatest
. Update the docs to describeuseLatestRef
as the recommended alias ofuseLatest
.Step two: a major release that deprecates
useLatest
In the next major release, deprecate
useLatest
. Remove it from the docs (or mark it as deprecated in the docs), but keep it in the code and add a dev mode warning:(you would want to cache the message so it only logs one time, like React logs)
Step three: another major release that removes
useLatest
A long time from now, you cut a 2nd major release that removes
useLatest
altogether.Is it worth the effort? idk, what do you think?
The text was updated successfully, but these errors were encountered: