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 trialJason Pallone
11,340 PointsCourse to use react and express together?
Is there a course on treehouse i can take, that I use react and express together? I want to know how we get data from express using react, and also how they work together, I don't understand how express will render its PUG and react renders HTML, I'd like to see a course so I can see how to use them to make a fullstack app.
1 Answer
Connor Walker
17,985 PointsFrom the sounds of it, what you want to create is a REST api with a react front end. Theses should be two separate projects. What I would recommend is doing the back end Node JS Express Courses here AND doing the react course.
I'm not sure if TreeHouse offers a course that you are looking for but as much as I love this website, it shouldn't be your only source of learning.
For what you want to do, basically you need to create an Express application that returns a JSON file with each request rather than a view (e.g. PUG). You'll then need to create a react app that uses AJAX to talk to the Express application you have created and use the JSON that it has returned to populate the page with data.
To do this I would recommend getting comfortable with Node/Express and React here, and then follow this YouTube series for how to create an Express Rest API. Make sure you are comfortable with AJAX and other plain JS and with this you should be able to make a React Express website
Jason Pallone
11,340 PointsJason Pallone
11,340 PointsThank you! I took the express/node courses here, working on the React courses now. That youTube video should clear it all up for me, thank you for the help!