spencercarli / react-native-meteor-boilerplate

MIT License
628 stars 139 forks source link

Mantra: API Integration #1

Closed wbashir closed 8 years ago

wbashir commented 8 years ago

This is an awesome boilerplate and a great starting point for someone looking to integrate RN and Meteor. Have you thought of or considered the new Mantra architecture for any connections with file structure, components or modules against what you have started?

https://kadirahq.github.io/mantra/

smooJitter commented 8 years ago

@wbashir that would be icing on the cake! Mantra claims to support this sort of abilities. Consider your work in this area, it would be very helpful to see at react-native+meteor+mantra-bolierplate. Especially one that uses react-native-router-flux. The mantra atom package makes for straight forward reasoning about mantra.

spencercarli commented 8 years ago

Thanks for the feedback @wbashir and @smooJitter! Mantra is definitely on my radar.

One concern I have with integrating any external frameworks is how opinionated/complicated it may get and the additional learning it would take to get started.

For example, in a client project I'm using Redux as the data store and I've really enjoyed it - but there is definitely a learning curve associated with Redux. It's something I'm trying to weigh the pros and cons on.

Maybe the best route would be, as @smooJitter mentioned, creating a separate react-native+meteor+mantra-bolierplate.

smooJitter commented 8 years ago

Hello, Mantra is actually really easy to pick up. It's nothing more than a way to organize code where actions, data fetching, and UI components are maintained separately. Two core concepts holds it together. Actions and data composed via container components are passed stateless UI components via props and injected dependancies (similar to Redux connect). For Meteor, Mantra provided a nice way around Redux, however Mantra runs into a few challenges in the case of React-Native because Meteor's Tracker, Minimongo, and Reactive-dicts are used for Local State management. These tools are now available through meteor-react-native, so it didn't take a lot to integrate the two.

The challenge however, is the approach Meteor-React-Native handles reactive data loading (@connectMeteor and getMeteorData()). There's a nice write-up that clarifies the key difference. You may find it interesting considering your recent article about Pubs/Subs versus Methods. What makes Mantra so cool, the ease of switching between React and React-native UIs.

spencercarli commented 8 years ago

I'm leaning towards letting people choose their own way of building out the Meteor side of things. If I tried to add that to this boilerplate I feel it may be too overwhelming for new people. In the latest major update I've referenced Mantra and the Meteor Guide to look at as ways to organize the Meteor app.

I appreciate everyone's input!