• +91 9723535972
  • info@interviewmaterial.com

ReactJS Interview Questions and Answers

Related Subjects

Question - How to create components in React?

Answer - There are two possible ways to create a component. 1. Function Components: This is the simplest way to create a component. Those are pure JavaScript functions that accept props object as first parameter and return React elements: 2. function Greeting({ message }) { 3. return {`Hello, ${message}`} 4. } 5. Class Components: You can also use ES6 class to define a component. The above function component can be written as: 6. class Greeting extends React.Component { 7. render() { 8. return {`Hello, ${this.props.message}`} 9. } }

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners