What are the components in react.js?

Answer

Components are usually a piece of UI(User Interface).Components are also called as building block of react app.
There are two major components in react.js:


1)Functional Components- They don't have no state of their own and only contain render methods and it also called as stateless components.
function Greeting(props) {
return <h1>Welcome to {props.name}</h1>;
}


2)Class Components-It can hold and manage their own state and also have their own render methods to return JSX.It also have state ,so it is also called stateful components.
class Greeting extends React.Component {
render() {
return <h1>Welcome to {this.props.name}</h1>;
}
}

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 ---