React Component XML Syntax Passing Input by props | Indiantechonera - IndianTechnoEra
Latest update Android YouTube

React Component XML Syntax Passing Input by props | Indiantechonera

Creating a React Component with XML Syntax Passing Input by props | Indiantechonera

Build simple react components that implement a render () method, which takes input data and returns data to display. Use as XML-like syntax called JSX. Input data, passed into the component can be accessed by render () via this.props 

Creating a React Component with XML Syntax Passing Input by props | Indiantechonera


Hello.js

function Hello (props) {
  return (
    <h1>
      Hello {props.fname} {props.lname}
    </h1>
  )
}

export default Hello

index.js

import React from 'react'
import ReactDOM from 'react-dom/client'
import Hello from './Hello'
const root = ReactDOM.createRoot(document.getElementById('root'))
root.render(
  <>
    <Hello fname='Sam' lname='Edward' />
  </>
)

Post a Comment

Feel free to ask your query...
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.