In: Computer Science
Which of the following shows the react hooks in the proper order according to the React Lifecycle?
ComponentDidMount, ComponentWillMount, ComponentWillUpdate |
||
ComponentWillMount, ComponentDidMount, ComponentDidUpdate, ComponentWillUnmount |
||
ComponentWillMount, ComponentWillUpdate, ComponentDidMount |
10 points
QUESTION 2
Which of the following is an advantage of using controlled inputs? Check all that apply.
front-end authentication of users |
||
in-place feedback, like validations |
||
disabling a button unless all fields have valid data |
||
enforcing a specific input format, like credit card numbers |
Answer Option B
Reason: Option B is correct and rest of the option are because in a react lifecycle. At first, ComponentWillMount will run before informing the server on the client as well as the host.
Then ComponentDidMount comes after render is done only on the client
The ComponentDidUpdate is called after the rendering is done
The ComponentWillUnMount comes after the component is unmounted from the dom
Answer 2) Option B,C and D
Reason: Option A is incorrect because controlled inputs are not used to authenticate user.
Option B is correct because in place feedback like validation can be used by controlled inputs in order to add a dynamic feature.
Option C is correct because we can disable a data or update something dynamically in order to provide an additional data.
Option D is correct because it can be used to force the user to provide the input in a specific order.
If you liked the solution then give a thumbs up ? it will be really appreciated ?