-
Notifications
You must be signed in to change notification settings - Fork 31
feat: support for solid-js #92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
There's a problem with the implementation of the Because the We'll need a way to pass a function/getter to |
Please take a look at my vue 2/3 implementation UPD |
Do you think we can open a PR to TanStack Store Vue/Solid/Svelte instead for them to accept a getter/ref instead? Or just improve it all in all? |
Fix link |
You can of course open a PR with something like this change. Since this package is small I don't see any restrictions for using the core version. without framework wrappers export const useStore = (
getStore: () => Store<any, any> | Derived<any, any>,
selector: (v: any) => any
) => {
let unsub = () => {}
const state = createMemo(() => {
const store = getStore()
const [slice, setSlice] = createStore({
value: selector(store.state),
})
unsub = store.subscribe(() => {
const newValue = selector(store.state)
setSlice(`value`, reconcile(newValue))
})
return slice
})
onCleanup(() => {
unsub()
})
return () => state().value
} UPD |
No description provided.