-
Notifications
You must be signed in to change notification settings - Fork 755
How to use Mobx with react-rails? #889
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
Comments
If you're using This is unlikely to be a react-rails gem issue, but does follow the general trend of being hard to debug when things go wrong in JS land. See this Redux issue as a possible related thread. |
Im not using webpacker but im using browserify rails.
… Il giorno 08 apr 2018, alle ore 21:30, Greg Myers ***@***.***> ha scritto:
If you're using react-rails with Webpacker, react-dom will already be installed.
Have you tried shimming react-dom to global namespace so mobx can get a hold of it?
https://webpack.js.org/guides/shimming/
This is unlikely to be a react-rails gem issue, but does follow the general trend of being hard to debug when things go wrong in JS land. See this Redux issue as a possible related thread.
#878
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I apologise but I'm unlikely to be able to help you with this then. We only support Sprockets and Webpacker, and Webpacker is preferred. Still, it's all JS so hopefully the same concepts apply: https://github.com/thlorenz/browserify-shim Might this help to make |
I managed to make mobx work like this:
And I've npm packages with yarn:
Now all works fine, but if I enable server rendering (with
|
I figured out, this a repo with the setup to make all work! https://github.com/pioz/rails_with_react-rails_and_mobx |
Glad to hear it worked OK. Well done and thanks for linking the solution 👍 |
Is there a way to use
mobx-react
with react-rails?If I import
mobx-react
(import {observer} from 'mobx-react'
) in my jsx files I get the follow error:and if I add react-dom with
yarn add react-dom
all crash with this error:Any idea?
The text was updated successfully, but these errors were encountered: