Tutorials

Tutorials

Get Advanced Microsoft Office & Python Training

For any query mail at: uniqueshikshapoint@gmail.com

Use of different files in Public folder in react

Use of different files in Public folder in react

Package.json:

This is a JSON(JavaScript Object Notation) file that includes key information concerning your project. This is a required file that is needed to run any React project. This file includes metadata such as name , author and version as well as starter scripts and dependencies used in the project.

Logo.svg

SVGs are scalable, fully customizable, lightweight, and easy to animate image formats. We can use SVGs as an icon, logo, image, or backdrop image in your react application.

Index.js

It is the main file in which we will write our complete code.

Index.css

Just like a simple css file

robots.txt

After launching the website, it is used in SEO.

manifest.json

The web app manifest provides information about an application (such as name, author, icon, and description) in a JSON text file. By modifying properties in the JSON file, you can modify a number of details in your application, including its: Name. Description. App icon.

index.html

It is the only file that is not to be developed. As we will do all development in index.js.

Some Important Points:

  1. In starting i.e. at beginner level only these files are required:

In public -> index.html

  1. src -> index.css and index.js
  2. noscript tag is used to show only the message given in tag when javascript is disabled on the browser. The <noscript> tag in HTML is used to display the text for those browsers which does not support script tag or user has disabled the script on the browser. 

Sample code in index.js

import React from 'react';

import ReactDOM from 'react-dom';

ReactDOM.render(<h1>My Test page</h1>,document.getElementById('root'));

 

Here (<h1>My Test page</h1> is not a HTML but it is jsx.

Here React must be imported to use JSX



:19/02/2023