React Tutorials/React App

  • Home
  • Database Certification
    • OCP Exam
    • Free Computer Book
    • Ebooks Download
  • Interview questions
    • SQL
      • Top Ten queries
      • Conditional Joins
      • Merging Rows
    • View In Oracle
    • Simple Queries
    • Conversion Function
  • Basic queries
    • Replace Function
    • Date Function
  • Home
  • DBA
    • Set Oracle Password
    • Bollean Datatypes
    • PLSQL BLOCK
  • Downloads
    • Express Edition Oracle
    • Sql Developer
    • Documentation
      • Office
  • Cursor
    • Explicite Cursor
      • Sub Child Category 1
      • Sub Child Category 2
      • Sub Child Category 3
    • Child Category 2
    • Child Category 3
    • Child Category 4
  • Featured
  • Tupperware Products
  • About Me

Monday, May 8, 2023

React Components

 May 08, 2023     No comments   

 React Components,Components are like functions that return HTML elements.

Components are independent and reusable bits of code. They serve the same purpose as JavaScript functions, but work in isolation and return HTML.


Components come in two types, Class components and Function components, in this tutorial we will concentrate on Function components.

Using a component 

Now that you’ve defined your Profile component,

you can nest it inside other components. For example, you can export a Gallery component that uses multiple Profile components:


Class Component

A class component must include the extends React.Component statement. This statement creates an inheritance to React.Component, and gives your component access to React.Component's functions.


The component also requires a render() method, this method returns HTML.

import React, { Component } from 'react'


 class Car extends React.Component {

  render() {

    return (

         <h2>Hi, I am a Car!</h2>

    )

  }

}

export  default Car


For example, you can export a Car component  into App.js File.

Create App.js file and the following code.

import React, { Component } from 'react';


import './App.css';

import Hello from './components/Hello';

function App{

  return (

   <div>

    <Hello/>

      

    </div>

  );

}




output is:--

Hello I m Car Class



  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook
Older Post Home

0 Comments:

Post a Comment

Click on the links below to visit site

Popular Posts

  • Create a New React App
      Create a New React App   Install   NodeJS and NPM. NodeJS and NPM are the platforms need to develop any ReactJS application. .. . Us...
  • React Components
     React Components,Components are like functions that return HTML elements. Components are independent and reusable bits of code. They serve ...

Recent Posts

Unordered List

Pages

  • Home

Text Widget

Blog Archive

  • May 2023 (2)

Search This Blog

Powered by Blogger.

Report Abuse

About Me

My photo
Hemalata
View my complete profile
header ads

Technology

3/Technology/post-list

Recent in Sports

3/Sports/post-list

Business

Business/feat-big
  • Home
  • About
  • Contact Us
  • Home
  • Features
  • _Multi DropDown
  • __DropDown 1
  • __DropDown 2
  • __DropDown 3
  • _ShortCodes
  • _SiteMap
  • _Error Page
  • Mega Menu
  • Documentation
  • Video Documentation
  • Download This Template

Popular Posts

Create a New React App

Create a New React App

React Components

React Components

Menu Footer Widget

  • Home
  • About
  • Contact Us

Social Plugin

Sample Text

Copyright © React Tutorials/React App | Powered by Blogger
Design by Hardeep Asrani | Blogger Theme by NewBloggerThemes.com | Distributed By blogger Templates