`useStore` marked as deprecated without clear fix #2203
Describe the bug#
Seems around v1.33.0 of @tanstack/react-form, useStore was marked as deprecated with the following message
@deprecated — Use useSelector instead.
Tanstack form does not export useSelector unlike the previous useStore. Additionally, the documentation still uses useStore and I couldn't find any details in changelogs.
I'm guessing the upgrade path is to import useSelector directly from tanstack store? Perhaps that could be called out specifically somewhere (both in jsdoc and in the docs).
Your minimal, reproducible example#
n/a
Steps to reproduce#
n/a
Expected behavior#
There's a clear migration path for deprecated funcitonality.
How often does this bug happen?#
None
Screenshots or Videos#
No response
Platform#
n/a
TanStack Form adapter#
react-form
TanStack Form version#
v1.33.0
TypeScript version#
v6.0.3
Additional context#
No response
For future readers: I ended up manually installing tanstack store and importing useSelector from there. Seems to be working as well as before!
For future readers: I ended up manually installing tanstack store and importing useSelector from there. Seems to be working as well as before!
Why would they mark useStore as depricated and push us to install an
alphaversion of other library?so confuse, this make my agent just install tanstack react-store, I have to eslint-disable ts/no-deprecated. pls fix asap
Attempted fix here: https://github.com/TanStack/form/pull/2206
It seems
@tanstack/react-storeis a peer dependency, so I think this is missing from the documentation, we need to importuseSelectorfrom there.-- import {useForm, useStore} from '@tanstack/react-form'; ++ import {useForm} from '@tanstack/react-form'; ++ import {useSelector} from '@tanstack/react-store';Sorry all: To be clear
useStoreis deprecated in Store, but is not deprecated in usage alongside Form v1. You're welcome to update touseSelector(fully supported,useStoreactually aliases to it), but rest assured that this is a TSDoc issue and you can continue to useuseStoreuntil Form v2 (which will be explicitly called out in our migration guide)crutchcorn(GitHub profile, opens in a new tab) closed this
I installed
react-storealongside forms but now it's complaining thatreact-domis a missing a peer dependency [of react-store] which is not needed in react-native codebase
Sign in to join this conversation.
Thanks for saving my time and logging this issue, I was confused as well after seeing this.