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 trial

JavaScript React Components (2018) Build Modular Interfaces with Components Separating Function Components Into Modules

Luke Markham
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Luke Markham
Front End Web Development Techdegree Graduate 17,289 Points

Importing CSS into a J.S file

I'm just curious what is happening here? The CSS is not linked in index.html.

So I believe it's included in the mounting done in the <div id="root"></div

Is it somehow complied by React-app? if so what's it compiled into ? How can the browser know its CSS when its in a JS file ?

2 Answers

Had the same hiccup with CSS, give this a try:

1) Downloading the files in the "Downloads" section of the video after running npx create-react-app my-app 2) Open scoreboards inside of the recently created React edition of scoreboards. 3) Replace src folder with the one provided in the "Downloads" section (it'll have a component folder) 4) Optional: if preferring the code from React Basics in app.js, copy and paste it in to update

Happy Coding!