Closed FredrikSigvartsen closed 4 years ago
Please provide a reproduction, ideally with CodeSandbox... Or simply wait and hope someone would be willing to dig through that unformatted piece of code ;)
Hi again,
Thank you for answering. I've made a reproduction here: https://codesandbox.io/s/gatsby-starter-default-ixlg8?fontsize=14
This is code example. But I'm having some Node-issues on Codesandbox that I don't seem to fix. Is that still a problem?
Well, you shouldn't be using Gatsby :) There is a one for React.
Sorry, did not realize you have a Gatsby project actually :) I know nothing about that, so hopefully, someone else can chime in.
I've added it to a public repo: https://github.com/FredrikSigvartsen/glowing-octo-couscous It's also public: https://quirky-chandrasekhar-6d307e.netlify.com/shop/positioning/
The mobx actions don't work in production, only using "gatsby develop". I'm not sure why.
Please note that @babel/plugin-proposal-class-properties
should be configured with loose: true
in your babelrc
. Not sure if that is the cause, but it is incorrect at least. See https://mobx.js.org/best/decorators.html#enabling-decorator-syntax.
Oh this issue was inactive for a year already. Closing for now.
React component won't rerender
Hi everyone.
I'm fully aware of earlier issues regarding mine, but I can't seem to find an answer that matches mine. So that is the reason I publish this here.
I'm working in a Gatsbyjs project (React based), and I'm having trouble with my props not updating, and therefore the component would not rerender.
With Chrome plugin Mobx-devtools, I can see that my actions are triggered, and I also see that the state is changing. But, it won't trigger a an update in the React component. But when I trigger a new render(), the updated state is showing.
What do I have to do, so the React component automatically rerenders?
Here is my code: ShopModel.js:
Positioning.js:
wrap-with-provider.js: