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 PointsHow does Redux mix with MongoDB?
Ok so when you make a NodeJs / Express app you would normally use some sort of templating library/language such as Pug or HandleBar to output the views correctly and most importantly exchange Response and Request data with the Frontend.
Now my question is How would you mix React/Redux with MongoDB/NodeJs?
I ask this because I want to know if were not using Pug (formally known as Jade) to handle the structure of the frontend and instead am using React how would that play it's part in the mix and send Response and Request data to the front end?
The whole idea behind this question is how you can persist data when using React/Redux and I know that you can do that with Express/MongoDB now im just trying to figure out how I can use that with RectJs.
1 Answer
Andrew Chalkley
Treehouse Guest TeacherThe simplest way would be something like this: You use React and Redux on the front-end a client and then Node.js/MongoDB as the back-end serving as an API for the front end. All the data coming to and from the Node.js server in the request/response should be API calls (JSON objects).
Lucas Santos
19,315 PointsLucas Santos
19,315 PointsHey Andrew! thanks for the reply and Happy Holidays!
I see ok so that means I would need to use something like jQuery just to make the calls to the API then handle the end API in Nodejs/Express correct?
Seth Kroger
56,413 PointsSeth Kroger
56,413 PointsYes, or you can use smaller, AJAX only libraries like the fetch() pollyfill.
Lucas Santos
19,315 PointsLucas Santos
19,315 PointsThanks Seth!