Meteor + React Native, best approach to use Mini Mongo?

What is currently the best approach for making data reactive in React Native apps. MDG are bringing React Native into core I heard but I’m not sure how long that is going to take. What are peoples favourite packages for client side storage, I’ve seen a few git repos using Minimongo:



Any decent advice or preferred repositories to learn from would be great!

2 Likes

Here are a few additional repositories to watch,

graphql (cutting-edge)

ddp


The first looks like it might be the way to go. The second and third approach relies on DDP and draws from the minimongo-cache links you already posted. @spencercarli noted an unspecified concern regarding the the ddp package ( https://github.com/hharnisc/node-ddp-client ) used in his react-native-meteor-boilerplate. Perhaps he can add more to this.

1 Like

Yeh a lot of hype about graphql on the forums, thanks alot for the links @jitterbop

Just to expand on my concern with the ddp-client package. The first is the inconsistency with documentation. v0.1.2 uses minimongo-cache behind the scenes while v0.1.1 uses a plain object. The lack of documentation around this change has caused the most confusion in my tutorials.

Also, there seems to be an issue with reconnecting when the connection was interrupted. Lastly, I’m not a huge fan of minimongo-cache purely because I’m using redux for client apps and have found the experience to match my needs better. minomongo-cache may have a place but I think it should be independent of the ddp client implementation.

@glovegrove out of curiosity where did you hear that MDG was bring an RN implementation into core? I’d like to do a little more digging into that.

2 Likes

RN at the core of MDG is s bit new to me also. There is much talk about React but not much about React-Native (consider this forum) and that’s probably because there are no real complaints about Cordova from Meteor, Angular, Ionic users. Can you point to a few active react-native communities? I’m finding many, many, naming collisions build problems with react-native packages.

Can’t seem to re-find it but was in this forum or somewhere similar, though sounds more like i may have got mixed up with comments on graphql within a react native post @spencercarli @jitterbop.

We’re using 0.1.2 for the ddp package, currently don’t know a lot about redux however, what are you using to replace minimongo? @spencercarli Do you use Asynchstorage instead from React Native? That’s what we’re currently using, though I’m not sure of the ins and outs of using this.

(EDIT) Looked at Redux further, looks more promising than using minimongo moving forward in light of the blog posts about GraphQL from MDG. What i’m thinking of is using DDP + Redux for now and then eventually move over to GraphQL + Relay + Redux as a future solution? Does this sound correct @jitterbop @spencercarli or have I misunderstood anything :smile:

Honestly I’ve been using plain JavaScript to do my querying and it’s been great. JavaScript has come a long way now. I’ve been using the native map, filter, reduce, sort, and find functions with arrow functions and it works great. Throw in a little bit of lodash too, and immutable for performance.

@lai Any repos you can point to as some examples?

As @lai mentioned I’m also just using plain javascript to do querying/sorting etc. It’s a different api than Mongo so you don’t get that sense of “unity” you do when working with minimongo in a traditional meteor app but you don’t get that feeling (in my opinion) when developing with RN and Meteor, it’s very much the client and the server.

As for a current architecture we’re using in a client app with Redux is as follows: Component dispatches a thunk action, inside the thunk action we dispatch another action that handles our optimistic UI then we make the actual ddp call, and in the method callback we dispatch a final action to confirm or revert our optimistic update. It’s a little complex on the action creator side but very clean api from the component side of things.

I don’t have many opinions on GraphQL in Meteor currently (I try to wait for dust to settle a bit before making any choices) but it does seem promising! Especially for React/React Native applications.

3 Likes