In the previous section, we learned about JSX and we access the React and ReactDOM package using CDN. However, in real life work in environment instead of CDN you will use create-react-app package to generate a React project starter(boilerplate). The initial public release was on Jul 22, 2016. Before this developer used to configure webpack which a JavaScript module bundler, babel and all the necessary packages manually and this used to take half an hour or may be more. Now, create-react-app will take care of everything and you will be in charge developing product only instead of spending too much time configuring and setting up projects. Before we start using different tools let's have a brief introduction for all the tools we are going to use in this challenge. You do not have understand everything but I will try to give a very short introduction about some of the tools and technologies which we use when we work with React.
In the previous section, we learned about JSX and we access the React and ReactDOM package using CDN. However, in real life work projects instead of CDN you will use create-react-app package to generate a React project starter(boilerplate). The initial public release of *create-react-app*was on Jul 22, 2016. Before this time, developer used to configure webpack which a JavaScript module bundler, babel and all the necessary packages manually to get started React and this used to take half an hour or may be more. Now create-react-app will take care of everything and you will be in charge of developing only instead of spending too much time configuring and setting up projects. Before we start using different tools let's have a brief introduction for all the tools we are going to use in this challenge. You do not have to understand everything well but I will try to give a very short introduction about some of the tools and technologies which we use when we work with React.
## Node
## Node
Node is a JavaScript run time environment which allows to run JavaScript on the server.Node was created in 2019. Node has played a great role for the growth of JavaScript.
Node is a JavaScript run time environment which allows to run JavaScript on the server.Node was created in 2019. Node has played a great role for the growth of JavaScript. React application starts by defaul at localhost 3000. The create-react-app has configured a node server for the application the React Application. We will see create-react-app soon.
If you do have node, install node. Install [node.js](https://nodejs.org/en/).
If you do have node, install node. Install [node.js](https://nodejs.org/en/).
@ -74,13 +74,14 @@ NPM was created in 2010. You do not need to install NPM separately when you inst
## Visual Studio Code
## Visual Studio Code
We will use Visual Studio Code and [download](https://code.visualstudio.com) and install it if you do not have one yet.
We will use Visual Studio Code as a code editor and [download](https://code.visualstudio.com) and install it if you do not have one yet.
## Browser
## Browser
We will use Google chrome
We will use Google chrome
## Visual Studio Extensions
## Visual Studio Extensions
You may need to install these extensions from Visual Studio Code
Now your react app should run at localhost 3000. Go to the App.js and modify the content by writing some text, you will see the latest change on the browsers.
Now your react app should run at localhost 3000. Go to the App.js and modify the content by writing some text, you will see the latest change on the browsers.
Let's see the React boilerplate which has been created by create-react-app. Whenever you create a new project you run create-react-app and name of the project.
Let's see the React boilerplate which has been created by create-react-app. Whenever you create a new project you run create-react-app and name of the project.
In the following React boilerplate, there are three folders:node_modules, public and src. In addition, there are .gitignore, README.mde, package.json and yarn.lock. In some of you instead of yarn.lock, you may have package-lock.lock.
In the following React boilerplate, there are three folders:node_modules, public and src. In addition, there are .gitignore, README.mde, package.json and yarn.lock. In some of you instead of yarn.lock, you may have package-lock.json.
It is good to know these folders and files.
It is good to know these folders and files.
- node_modules - store all the necessary node packages of the react applications.
- node_modules - store all the necessary node packages of the react applications.
- Public - index.html - the only HTML file we have in the entire application
- Public
-index.html - the only HTML file we have in the entire application
- favicon.io - a favicon
- favicon.io - a favicon
- manifest.json - is use to make the application a progressive web app
- manifest.json - is use to make the application a progressive web app
- other images- which can be used for open graph image or for other purposes
- other images- which can be used for open graph image or for other purposes
![JSX using create react app to render more jsx](../images/rendering_multiple_jsx_elements_create-react_app.png)
![JSX using create react app to render more jsx](../images/rendering_multiple_jsx_elements_create-react_app.png)
## Style in JSX
## Styles in JSX
Let's apply style to the JSX elements. We can style JSX either using inline style, internal or external CSS. Now, let's apply an inline style to each JSX element.
Let's apply style to the JSX elements. We can style JSX either using inline, internal or external CSS styles. Now, let's apply an inline styles to each JSX elements.
How do we import images, video and audio in react? Let's see how we import image first.
How do we import images, video and audio in react? Let's see how we import image first.
Create images folder in the src folder and save an image. For instance let's save asabeneh.jpg image and let's import this image to index.js
Create images folder in the src folder and save an image. For instance let's save asabeneh.jpg image and let's import this image to index.js. After importing we will inject it to a JSX expression, user. See the code below.