Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialLucas Santos
19,315 PointsReactJs + Redux + MongoDB??
I know MEAN Stack and I got into learning ReactJs not to long ago and am curious about something with React and Redux.
Wanted to know the best method for saving data like in MEAN Stack. I would normally just use Express with MongoDB.
Is that method of saving data how the React community does it as well???
I would imagine that it would be even easier with React using Redux because everything gets saved onto the Store that's essentially JSON. Also i'm assuming that we wouldn't need some sort of templating language like Pug because React already takes care of that with components and what not. Would really like some insight on this.
Thank you.
1 Answer
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsI think whether or not you use MongoDB has more to do with the trade-offs between SQL and NoSQL databases, and what is right for your project. I'm not an expert, and it's still evolving, but my understanding is that SQL is better when you have a lot of relationships between objects, and the 'child' nodes of something are things that are also entities in their own right (like if you have a person who has children, those children are also people, not just an item is someone's array, so it's better to have a reference to an id rather than nesting that data inside). Also my understanding is that SQL is better at transactions that are very important, like transferring money from person to person. NoSQL can't guarantee that something might get dropped in the transaction, but in some cases it doesn't really matter. But NoSQL is supposed to be very fast and flexible, and also has an easier learning curve for new developers.
Here's an article about it: https://www.sitepoint.com/sql-vs-nosql-choose/
Lucas Santos
19,315 PointsLucas Santos
19,315 PointsHey Brendan I really appreciate the reply but I think you misunderstood my question. I wasn't necessarily asking if I should use NoSQL or not. My question was how the React community uses MongoDB with ReactJS
Because you would normally need to use a templating library/language such as Pug or Handlebar when using NodeJs. So I wonder how React mixes without a templating library/language and what not.
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsBrendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsI don't think it's a good idea for your client side framework and backend database to be married together really closely. Ideally, you could have an iOS and Android app that are also talking to the same server. And you could choose down the road to swap out your database and your apps would still work as long as you still respond with JSON in the same format. Maybe this helps? https://teamtreehouse.com/library/rest-api-basics