image
React Project Anatomy

Contents

The course is part of this learning path

Start course
Difficulty
Beginner
Duration
11m
Students
2780
Ratings
4.8/5
starstarstarstarstar-half
Description

This module will introduce you to the React Development Environment. You’ll also look at some useful tools available in the React environment, as well as looking at a React project anatomy and how React interacts with the DOM.

Learning Objectives 

The objectives of this module are to provide you with an understanding of: 

  • Developer tools available for React 
  • How to set up the developer environment and a skeleton React application 
  • Security concerns with React 

Intended Audience  

This learning path is aimed at all who wish to learn how to use the ReactJS framework.  

Prerequisites

It is essential you understand the face of contemporary web development to attend this course. We insist upon JavaScript experience, along with good HTML and CSS skills. 

Feedback 

We welcome all feedback and suggestions - please contact us at qa.elearningadmin@qa.com to let us know what you think. 

Transcript

So what did create-react-app do when we ran the command? First of all, it created a folder structure for the application. It then created a file called package.json. This file holds a record of all of the main dependencies that create-react-app uses, along with some other meta information about the project. You can see that along with the React library installed at the latest version available, there's also a React DOM package. 

To run a React application, these are the only dependencies you actually need. The react-scripts dependency is used by create-react-app to execute several steps with one command. You can see in the script section the start, build, test, and eject all called react-scripts as part of their command. There are also three testing dependencies installed which, if we're going to use testing in our application, provide us with the basic testing tools needed. 

The package-lock.json file contains information about the dependencies of these dependencies. And the node-modules folder contains all of the dependency code. The public folder is where we find our index.html file. This is the file that the browser uses as a base for the file that is compiled when we run or build our application. The public folder is where we found our index.html file. 

This is the file that the build process uses as the base for the file that is created when we run or build our application. The src folder is where the developer will do most of their work. It contains some config files like setupTests and serviceWorker, and also the fileIndex.js. 

This is important as it is where the JavaScript in our application will start to execute. I'll explain more about the contents of this file in another video. But essentially it tells React where to put our application, and how to build it. It has a CSS file that is attached to it, so any global styles could be put in there. CSS files are bundled and minified as part of the build process too. The app.js file is a React component. It is a mixture of JavaScript and HTML, which may look strange if it's the first time you've seen it. But believe me, you'll soon get used to it. 

Essentially we've got a JavaScript function that eventually returns the representation of the DOM element. This is what React will use to render your UI. Again, this has a CSS file attached to it. And again, any styles you want to propagate through your application can be put in here. The final file we're going to look at is the App.test.js file. create-react-app comes with Jest baked into the setup. And this is a skeleton testing file. We'll get into testing in other videos. 

The final file to point out is the README.md file. If we open this, we can see explanations for the script commands. npm start runs and hot loads our application. npm test starts the test runner and runs the tests, which again, hot load if we make changes to them. npm run build which readies the application for deployment. And npm run eject, which does things you might regret later.

About the Author
Students
20473
Labs
6
Courses
29
Learning Paths
14

Ed is an Outstanding Trainer in Software Development, with a passion for technology and its uses and holding more than 10 years’ experience.

Previous roles have included being a Delivery Manager, Trainer, ICT teacher, and Head of Department. Ed continues to develop existing and new courses, primarily in web design using: PHP, JavaScript, HTML, CSS, SQL, and OOP (Java), Programming Foundations (Python), and DevOps (Git, CI/CD, etc). Ed describes himself as practically minded, a quick learner, and a problem solver who pays great attention to detail. 

Ed’s specialist area is training in Emerging Technologies, within Web Development. Ed mainly delivers courses in JavaScript covering vanilla JS, ES2015+, TypeScript, Angular, and React (the latter is authored by Ed) and has delivered on behalf of Google for PWAs. Ed has also developed a new suite of PHP courses and has extensive experience with HTML/CSS and MySQL. 

Ed is responsible for delivering QA’s Programming Foundations course using the Eclipse IDE. His skillset extends into the DevOps sphere, where he is able to deliver courses based around Agile/Scrum practices, version control, and CI/CD.

Covered Topics