Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Customizing Your Project

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 90,705 Points

Imports in React Projects

One of the most intimidating things I find about starting a project in React is knowing or remembering which imports you need to make in a react project and how they're actually formatted.

I know that this usually comes with practice and the error messages should be a good guide for us but I wonder if there's a definitive documentation or a list that can help us with this?

Same. Did you ever end up finding an easy way to make sense of them all? and/or some sort of a cheat sheet? Currently I'm taking some extra time to learn npm and Node better to see if that helps. But it might have a lot more to do with Webpack.

1 Answer

Please correct me if I am wrong. But out of all the react projects I have seen, mostly you need to import React and Components from react. import React, { Component } from 'react' I think these 2 will allow you to start building basic apps. All other imports are either some external node modules you have installed, which you have to look at their own documentation on usage or some refactored customized components that you created yourself.

You can check out the official documentation on React by Facebook for more info. I am speaking from experience as I haven't found any other good documentations. But please correct me if there are better documentations found.

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 90,705 Points

Hi Michael,

Thanks for responding, I knew someone would pick it up eventually :D

So yes, for basic projects you start with the basic imports for getting React itself hooked up and one import for each component. But beyond that, all I see is a whole load of import statements for me to get my head around, and I just think, am I thinking about this the wrong way; trying to remember a bunch of stuff instead of just how to find them?

Thanks