Replies: 1 comment 2 replies
-
See https://mobx.js.org/react-integration.html using React Context. Users
of your hook will still need to apply `observer`.
…On Sat, Jun 5, 2021 at 5:06 PM Collin Monahan ***@***.***> wrote:
Hi, googling this is kind of a trick since it just wants to show pages
about useObserver - that is not my question.
So I've got my app running along with stuff like
import React from 'react'import {observer} from 'mobx-react-lite'
const Widget = () => {
const store = useStore()
return (
<div><pre>{store.data}</pre></div>
)}
export default observer(Widget)
But now what I wanted was to create a hook that uses the store, like
const customHook = () => {
const store = useStore()
return makeSomeFunctionsOnTheStore(store.data)}
export default observer(customHook) // <-- this is apparently completely wrong
Wonder what's the best approach from here... Thanks!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2967>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBCOM47NU4QDIPWMZHLTRJDP7ANCNFSM46EW6QYQ>
.
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, googling this is kind of a trick since it just wants to show pages about
useObserver
- that is not my question.So I've got my app running along with stuff like
But now what I wanted was to create a hook that uses the store, like
Wonder what's the best approach from here... Thanks!
Beta Was this translation helpful? Give feedback.
All reactions