00:01Welcome to Mastering React reusable components
00:04where we will explore react js JSX and ES six.
00:09I'm Ben f your host,
00:10and this is a packed publishing production.
00:14Who are you? So assuming that you're taking this title,
00:17you know, ES five
00:19or basically you know, JavaScript,
00:22you might not know the latest, latest versions
00:24and latest APIs, but you're a JavaScript developer, but
00:28moreover than that, you're an independent problem solver.
00:31One of the problems, for example,
00:33that you're gonna encounter, which is not a big one, is
00:35that you need to install no JS and NPM.
00:39We'll leave a link in the descriptions of this chapter,
00:41but you have to make sure that it's installed and configured
00:44before you actually take the course,
00:46because that's gonna be the platform
00:48that we're gonna be working with
00:49to develop our applications.
00:53Who will you be by the end of this title?
00:55By the end of this title, you're gonna be a master
00:58of react reusable components,
01:00and that will entail also getting very familiar with JSX
01:04and ES six, and you'll be incredibly proficient
01:09in react js.
01:11So how is this course structured?
01:13Basically, the course is structured into five modules
01:16or five chapters,
01:18and each one of them covers one fundamental topic, starting
01:22with creating your first JSX component
01:25and setting up your environment.
01:27Then understanding what's new, what is the process,
01:30what is the idea behind react and how to work in it.
01:34We'll then dive deep into the world
01:36of components moving into reusable components.
01:40Once we have all of these,
01:41we're gonna go into a real world example
01:44as we build out a single page application in the last
01:48chapter of this title.
01:49So by the end of the title,
01:50you're gonna have a single page application running
01:54really, really cool stuff.
01:56Okay, so let's cover the first chapter.
01:58And really the first chapter is all about setting things up,
02:02setting up expectations, and creating your first component.
02:06So we'll set up our development environment
02:08and know the basics of how JSX works
02:11and also implement our first component in this lecture.
02:15We're gonna go ahead and set things up, namely setting up
02:19NPM and no js, assuming that you've done that process
02:22of the initial installation itself.
02:25And then we're gonna show you how to integrate webpac,
02:28understand what it is, and get it running.
02:31So let's jump right into it.
02:34As you probably guessed, our goal is
02:36to create react components
02:38and really learn how to leverage them.
02:40Now you could just start right away
02:43and just go through the React documentations.
02:45You'll find the JS fiddle option with JSX.
02:49Now, the problem with working with this way is
02:52that it's really convoluted
02:53and it's kind of hard to work this way, especially
02:56with our projects, which will have multiple files.
02:59And also we want to create reusable components
03:01that we could keep on our local storage
03:03that we wanna be able to retrieve easily.
03:06So for our sake
03:08and purpose for the run of this application,
03:10we're gonna assume that you have no JS installed
03:13and NPM installed.
03:15And by the way, when you installed no JS
03:17NPM gets installed as well.
03:19We're gonna always, we're gonna work
03:20with the current version, which is currently a 6.22,
03:24and we're gonna work with O also the current version of NPM.
03:27Now, last but not least, you're going to need
03:29to have access to a terminal.
03:31Now if you're running on Linux
03:33or on Mac, then you have no problem.
03:36You have terminal built into your operating system.
03:39While if you're working on Windows, make sure
03:42to check our links to oto, get C cig, I think it's called
03:47cig is basically that's the name
03:49and get it running on your device.
03:51Now, if you wanna really learn in depth how to work with NPM
03:54and no JS and how they relate to react js,
03:59make sure to check my title, full stack React Development,
04:02which will walk you through the whole flow
04:05until you become a full stack developer.
04:08But we're just gonna assume
04:09that you have NPM installed and no js.
04:11And by the way, the way you check that is
04:13by just type node minus V.
04:15If you see there that version, in our case it's six point 22
04:19and NPMV as well,
04:21and you get your version, then you know
04:23that you have NPM installed as well.
04:25Now when you install NPM
04:27and Node, you might have issues
04:28where things don't install properly,
04:31and the way you sort that out is
04:33through the documentation as well.
04:35You will find in the NPM documentation, how do you deal
04:38with errors which commonly happen on notes.
04:41So just follow the distri,
04:43the instructions in the documentation in NPM
04:47or check out my title full stack react.
04:50But we are gonna assume that you have no JS installed,
04:53that you have NPM installed and you have a terminal running.
04:57With that said, let's continue,
04:59and that you're familiar enough to roam around
05:01inside a terminal as well, just the basics.
05:04So with that said, what we goal,
05:06our goal in this specific lecture is to set up
05:09and configure webpac.
05:11Now Webpac, and by the way, it's also included in the links
05:14that are provided to the title to this chapter.
05:17So webpac, what is webpac?
05:19Webpac is in basically is a compiler that enables
05:23to automate different processes that involve your website.
05:27Now, why do we need that?
05:28Well, the basic idea behind setting up
05:31and configuring webpac is
05:32because we're gonna be running on the latest version
05:35of JavaScript and we're also going to use JSX
05:39and all these stuff, which we're gonna be learning in
05:42learning and exploring and doing throughout the title are
05:44not supported on browsers.
05:46To be able to address that, we need to compile the code
05:48and make basically revert it
05:50or convert it into ES five, basically making it available
05:54for most browsers
05:56and realtor, we're gonna make it, we're gonna make it work
05:57for all browsers, also browsers that don't have, yes,
06:01five installed and we're gonna see how to do that.
06:03But for, for us to do that, we don't wanna need to,
06:05every single time we take a peek at our website that we need
06:09to compile and then we need to go to the browser
06:11and then we need to click on refresh,
06:12basically creating a lot of steps.
06:14So instead of that, this lecture,
06:15we're gonna prepare the groundwork that will enable us not
06:19to click on refresh.
06:20Alright, so with that said, let's get, let's go ahead
06:23and start with our project.
06:24And I'm gonna go into my terminal Terminal,
06:27and by the way, I'm inside of my chapter one,
06:30but if you don't care, already know how to set up
06:34and configure Webpac and Babel
06:36and all the great things
06:37that we're gonna do in this chapter and beyond.
06:40Um, you could start with the starter file,
06:41which has everything already included.
06:44Now, the only thing that I would say,
06:45and I'm just gonna go into that folder here for a second,
06:47the only thing that I'm gonna say is if you decide
06:49that you're gonna go this route
06:50and you don't wanna learn all the process, which I urge you
06:53and encourage you to do so when you're in that file,
06:55type NPM install what that's gonna do,
06:58it's gonna install all the things that we preset
07:01but is not configured.
07:03Now, with that said, I don't want you to do that.
07:05I think it's really important for you to be very familiar
07:08with n with the environment.
07:10So I'm gonna go ahead
07:11and do all these steps with you on my own.
07:13Now we're gonna start off with basically an empty folder
07:17and I can, I'm gonna already set here an empty folder
07:19with the source folder inside of it that has nothing
07:22inside currently at this second, we're inside
07:24of our component folder of chapter one.
07:27And what I want you to do is I want to type NPM in it
07:31minus y, which will basically skip an interview process
07:35and automate and create basically a package JS ON file.
07:40Now this package, JSON file will have all the descriptors
07:43that are for the application
07:45that will let it know basic things that it needs.
07:48I'm not gonna dive too deep into it
07:49because again, you could learn a lot more about NPM
07:52and all the different usages of this file
07:55through my title full stack React.
07:58With that said, now that we have that JSON file configured,
08:01and by the way, that JSO file is right in the root
08:04of our directory, we have your package that JS O.
08:07Every time when we install new packages,
08:09every time when we install new things,
08:11that JSON file will get updated.
08:14So basically right now it's empty,
08:16but in a moment when we're gonna start installing things,
08:19you're going to start seeing
08:20that more information is being added into it.
08:23Now, in the process, while it's doing the installations
08:26of the things that we, and we want NPM
08:28to install into our application, what I wanna do
08:31before that is I want to touch a file
08:33that we're gonna be typing in,
08:35which is called Web pack do config js.
08:39I just want to create that file.
08:40Once I've created that file
08:42and I'll look into my editor, you'll see
08:44that I'll have the file, it's nice and empty,
08:46and we're gonna work on configuring webpac
08:48as the name implies.
08:50This is the configuration file
08:51that we describe the things we want webpac to do.
08:55But before we even do that, let's go ahead
08:57and start installing it so that way in the process
09:00as things are being installed,
09:01we could start building up that file.
09:03So I'm gonna go ahead, I'm gonna set NPM install,
09:07and I'm gonna say that I want to save this,
09:08but I wanna save it into Dev.
09:10So I'm gonna type their dash, dash save dash dev,
09:13which basically means
09:14that this is not something this live server is going to use,
09:17but our development of the server is going to use it.
09:21And in other case, it's not part of the server, it happens
09:24as an exterior exterior wrapper to the server.
09:27Or really this is not
09:28what you're gonna use in the production,
09:30but this is used really in development
09:32like we're doing right now.
09:33So I'm gonna go ahead and I'm gonna ask for web pack
09:36and I'm gonna also make sure
09:38that I'm gonna install version one dot something.
09:40So if there's a newer version,
09:42although right now there isn't,
09:43but once there's a newer version that uh, you'll install
09:46that version because our code is gonna be relied.
09:50So the features that are available in the version one
09:52of this library, so it's gonna make sure that we have them.
09:56So what I'm doing here is I'm installing web pack
09:59and I'm installing the web pack dev server,
10:01which is gonna basically create a live server for us
10:03that will enable us to automatically refresh our content
10:06and recompile on the fly, which is incredibly cool.
10:10Okay, so with that said, I'm gonna go ahead
10:12and start that installation process.
10:14And as the installation is going on,
10:16let's go into our editor
10:17and let's start playing around with that config file
10:20and let's get introduced
10:21to basically the way you export things in Node,
10:27well in js.
10:28And the way you do that is,
10:30and it's similar if you've ever uh, played with common js.
10:33So it's basically the common JS standard, which
10:36where you type module do exports.
10:40And what I'm doing here is I'm sending out an
10:42object in this lecture.
10:43We set up WEBPAC
10:44and started configuring our development
10:47environment in the next lecture.
10:49We'll continue down that path as we learn how
10:51to configure webpac development server.