Explain the purpose of render() in React.

Answer

It is mandatory for each React component to have a render() function.
Render function is used to return the HTML which you want to display in a component.
If you need to rendered more than one HTML element, you need to grouped together inside single enclosing tag (parent tag) such as <div>, <form>, <group> etc.
This function returns the same result each time it is invoked.

 

import React from 'react'
class App extends React.Component {
render (){
return (
<h1>Hello World</h1>
)
}
}
export default App

All react js Questions

Ask your interview questions on react-js

Write Your comment or Questions if you want the answers on react-js from react-js Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---