Question: React js questions: 1.What are the lifecycle methods of React? Give 4 examples. Briefly explain them. 2.Explain what are the different phases of component lifecycle.
React js questions:
1.What are the lifecycle methods of React? Give 4 examples. Briefly explain them.
2.Explain what are the different phases of component lifecycle. Give examples of method which will be called in those phases.
3.How to apply validation on props in React? Give example of how would you validate a following prop: {a: string value, b: 777}.
4.What is ref? Give example of how to create one.
5.Since its not possible to use for in JSX, how to implement a loop inside it given a list of elements to render. Give example.
6.What the difference between useState and useReducer? Why ever use reducer for managing state?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
