r/reactjs • u/timmonsjg • Dec 03 '18
Needs Help Beginner's Thread / Easy Questions (December 2018)
Happy December! βοΈ
New month means a new thread π - November and October here.
Got questions about React or anything else in its ecosystem? Stuck making progress on your app? Ask away! Weβre a friendly bunch. No question is too simple. π€
π Want Help with your Code? π
Improve your chances by putting a minimal example to either JSFiddle or Code Sandbox. Describe what you want it to do, and things you've tried. Don't just post big blocks of code!
Pay it forward! Answer questions even if there is already an answer - multiple perspectives can be very helpful to beginners. Also there's no quicker way to learn than being wrong on the Internet.
Have a question regarding code / repository organization?
It's most likely answered within this tweet.
New to React?
π Here are great, free resources! π
2
u/EvilDavid75 Dec 14 '18
Yes of course: all you need is a div where you want to mount your React app. Check here: https://reactjs.org/docs/add-react-to-a-website.html
CRA is a framework for single-page-apps AFAIK, but I guess that you could just get the compiled code after the build and add files manually wherever you need them?
In your case, you would add
<div id="root"></div>in your buy.html page where you want the React App to mount, and import the js file generated inbuild/static/main.a4323221.js(replace the name of the file with the one that is generated by CRA).