-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Using MobX instead of Redux #187
Comments
+1 |
1 similar comment
+1 |
Just started looking at MobX and I'd be interested in using it with RNN too.. |
According to https://github.com/aksonov/react-native-mobx it is "framework free" so in theory should be able to use it with RNN as-is. I will try this soon... |
If you could share a boilerplate if you manage to do it, it would be very helpful for the whole community I think! |
@perrosnk @adamski @knot123 there u go... navigation-mobx-example. |
@guyca it would make sense, to add the mobX example to this repo, as well. What do u think? |
@mastermoo Thanks for taking the initiative and making an example project. MobX sounds interesting and we're excited to hear you got navigation working with it. Are you using MobX with Navigation in production? If it's ok with you, I'll link your project and this thread in the readme file. Adding another example project isn't feasable at this time, since we can't commit to another framework. We have a lot planned for the library and officially supporting another framework will add a lot of overhead. |
Yes it's good with me.MobX is really a joy to use compared to redux. Yes, currently, I'm building a fairly complex app using Navigation and MobX. 😊Good to hear, that there is a lot planned for this library! I would really like to contribute to this repo, but I don't know any Objective C :/
From: Guy Carmeli [email protected] @mastermoo Thanks for taking the initiative and making an example project. MobX sounds interesting and we're excited to hear you got navigation working with it. Are you using MobX with Navigation in production? If it's ok with you, I'll link your project and this thread in the readme file. Adding another example project isn't feasable at this time, since we can't commit to another framework. We have a lot planned for the library and adding officially supporting another framework will add a lot of overhead. — |
+1 |
2 similar comments
+1 |
+1 |
Great work @mastermoo ! Optimally we would have the core Navigation, and on top of it (either another npm module completely or just a different module inside the framework) some wrappers that inject the state container logic into the screens. For example you import This is just an idea right now as we have far more pressing concerns. In any case, this shouldn't be hard, and far more extensible. Can be assigned to milestone 2.1.0 I think. |
@DanielZlotin though, do we even need to make RNN aware of any framework (Redux/MobX) at all? function _registerComponent(screenID, generator, CustomWrapper) {
const generatorWrapper = function() {
const InternalComponent = generator();
return class extends Screen {
// ...
render() {
if (CustomWrapper) {
return (
<CustomWrapper>
<InternalComponent navigator={this.navigator} {...this.state.internalProps} />
</CustomWrapper>
);
} else {
return (
<InternalComponent navigator={this.navigator} {...this.state.internalProps} />
);
}
}
};
};
registerScreen(screenID, generatorWrapper);
return generatorWrapper;
} which just takes a user-provided wrapper component. function CustomReduxWrapper(props) {
return (
<Provider store={store}>
{props.children}
</Provider>
);
} and then register a screen with this: Navigation.registerComponent('app.ExampleScreen', () => Example, CustomReduxWrapper); The benefit of this approach is that it removes knowledge of Redux (Provider + store) from RNN and also enables support for other frameworks. As for MobX support, my understanding is that it's already possible by just decorating components with |
Completly agree, and that was my plan. However I do think a helper wrapper On Sep 24, 2016 3:45 PM, "grin" [email protected] wrote:
|
+1 |
2 similar comments
+1 |
+1 |
I've created the mobx-react Provider which can be used with RNN. |
+1 |
I share @grin 's opinion on this - I think any form of coupling with things outside of react would hinder the project a great deal |
+1 |
2 similar comments
+1 |
+1 |
Hey guys, I have created a small boilerplate RNN + MobX with Provider (so we can use https://github.com/kanzitelli/react-native-navigation-mobx-boilerplate And if anyone is going to try it, please let me know how it goes 👍 |
@kanzitelli |
Hey @kanzitelli , I noticed that |
use componentWillReact |
+1 |
5 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
You guys should close this issue, state management has nothing to do with this project surely. |
+1 |
Is anyone using Mobx instead of Redux? If yes, would it be possible to share some boilerplate?
The text was updated successfully, but these errors were encountered: