-
Notifications
You must be signed in to change notification settings - Fork 139
Updated mobx, store via context, and functional components #239
Updated mobx, store via context, and functional components #239
Conversation
… to functional components
I converted StorybookUIRoot to a function (in spite of the comment): - I removed its "RN hot module must be in a class for HMR" comment; I tested this and found no problems with hot reloading enabled, for this component or the other components I've converted to functions. - Googling led me to https://mobx.js.org/best/stateless-HMR.html, which I think might also be old information; I tested the newly-functional components with react-devtools and it's displaying their names, so I think something must've changed with transpiling to fix that problem. Also, the new functional components seem to trigger warnings from the react/prop-types eslint rule. We don't put propTypes on our components because we've got Typescript to watch our back. So, I've turned off this eslint rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks amazing @bryanstearns !! I'm super stoked about this update.
Just a few changes/comments; otherwise should be ready to roll soon!
(Q. Do you see this as a patch, minor, or major release?)
…bility We need to lock mobx at 4.x because of facebook/hermes#28 (as well as the old version of JavaScriptCore in iOS 9 not supporting Proxies). We could move to 5.x if we are okay with not supporting iOS 9 and Hermes, but we don't think that's a viable path forward at this time.
…r own package.json config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I know you're testing this out on a side project, so I'll just approve and move on. Feel free to bring me back in if you need additional review.
@jamonholmgren I think this is more than a patch, but I'm not sure whether it qualifies for "major", sooo: minor? |
# [4.7.0](v4.6.3...v4.7.0) (2019-09-16) ### Features * **boilerplate:** Migrated to functional components, hooks, and context ([#239](#239) by [@bryanstearns](https://github.com/bryanstearns)) ([49d0b8a](49d0b8a))
🎉 This PR is included in version 4.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
So how to passing data to props with file root-store-context, pls create example, thank you so much ! |
I've bumped mobx to 6.x and mobs-react to 5.x, and switched to using context to provide the root store to the component hierarchy. I also converted our screens and shared components from classes to functional components.
Work-in-progress for now; I'm going to start a side project with this now and see how I like it.I've started a project with it and haven't encountered any problems, so I'm taking the "WIP" off this.Please object if you don't like this style of things, or just point and laugh if I've gotten things grossly wrong!