React is an open-source JavaScript library used for building user interfaces. It is used to handle the “View” layer for web and mobile applications. It also allows us to create reusable UI components. React DOM (Document Object Model) is a virtual DOM that is used for rendering the components of the DOM. The React DOM package has a name that implies is the glue between the React and the DOM. Even though it is a JavaScript library, people often refer to it as a framework, because the fact it has a lot of characteristics of a framework. But it is a JavaScript library, but not a framework. To know more about React.js there is no other place other than its official docs.
-
To create a new React App navigate to the Visual Code Terminal and type the following command
npx create-react-app project-name
for examplenpx create-react-app first-react-app
On executing the above command will install four packages such as
react
,react-dom
,react-scripts
andcra-templates
. -
After getting the success message Happy Hacking you now want to execute two commands to change the path or directory and start the server
cd name_of _project/
for examplecd first-react-app
andnpm start
or sometimesyarn
is preferable -
Later you will be prompted by the React Home page as shown below - Indication of Successful installation
Click on the local host link to view the above result.
-
Add the project to the workspace to see the folders
Files --> Add Folders to the Workspace --> Select your React Project Folder
-
Visual Studio Code
Visual Studio Code is used as a code editor for this project.
Download here.
Note: Available for Windows, Mac and Linux.
-
Node.js
Node.js is used for Run time.
Download here.
Note: LTS and Current versions are available. LTS is the stable version. The current is the latest updated version but it’s not stable. We often recommend the LTS version.
-
Figma
Used as a vector graphics editor and primarily web-based prototyping tool, with additional offline features enabled by desktop applications for macOS and Windows.
Download here.
Note: Available for Windows and Mac OS, with both online (web-based) and desktop downloading options.
- Create and set-up an Account in Netlify
- In your Visual Code Terminal Stop the Server using
Ctrl-C
- To create a production build use
yarn build
ornpm build
use it accordingly. - After successfull installations you will get a
build
folder in your project. - Install the Netlify CLI from the Visual Studio Code Terminal.
- Use the command to install netlify CLI -
npm install netlify-cli -g
- Sometimes you might get an error as
ps1 cannot be loaded because running scripts is disabled on this system
. - There are multiple ways to solve this. One of the easiest ways is to install Netlify on your Main Command Prompt not the Visual Studio Code one.
- You need to login to Netlify using
netlify login
. Enter all the credentials to log in. - To deploy the project lastly you need to type
netlify deploy
. - If you get an error saying
site not found
, then you need to unlink it by sayingnetlify unlink
- Make Sure you select "Create and Confiugure a new site". Sometimes it will ask your team name (Netlify Team Name).
- You can choose a random site name or give a custom one. Make sure to give a unique one.
- Provide the Build Directory as
./build
. - The suite would not yet been deployed from the given URL.
- Go to your Netlify Dashboard to the project. Click on
Site has not yet been Deployed
. Again click onDeploy Preview
this will unlock thePreview Deploy
which is a temporary URL. - After viewing the Preview, click on
Publish deploy
option to deploy your project. - Now you project is live and deployed on the internet.
Use the Git commands from the Visual Studio Code to either push, commit and pull to the GitHub Repository.
-
git remote add origin add-your-git-link
- To connect to your GitHub Repository -
git add README.md
- To specifically add new files -
git commit README.md -m "Fixed the Typo"
- To commit file changes with a message -
git push -u origin master
- To push the changes to the repository -
git pull origin master
- Before committing or pushing always pull the changes -
rm .git/index.lock
- Use the below command in the root directory of the application. This will delete the index.lock file and release the active lock
-
JSX full form in React?
- Java Standard XML
- JavaScript XML
- JavaScript XCode
-
React is a?
- JavaScript Library
- Framework
- Standalone Desktop Application
-
How many tags we can return in a functional component?
- Less than 1
- More than 1
- Absolutely 1
-
Which one is a default import?
- export {App} from "./App.js"
- import App from "./App.js"
- import {App} from "./App.js"
- export App from "./App.js"
-
Which hook is used to maintain the state?
-
useEffect()
-
useRef()
-
useCallback()
-
useState()
-
-
EventListener is a?
- function
- attribute
- props
-
Which function is use to remove an item?
- map
- delete
- filter
-
Which one of them is a spread operator?
- .
- ..
- ...
-
Udemy Course - React JS from absolute scratch by building your first React web app
Thanks to Anton Francis Jeejo