From 9e0797afa5dfd202a8b5071362df26f062321bc8 Mon Sep 17 00:00:00 2001 From: John Harold Rasco Date: Wed, 23 Nov 2022 10:23:01 +0800 Subject: [PATCH] RCT-150: 30 Days of React - Day 14 --- solutions/day-14/level1.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 solutions/day-14/level1.js diff --git a/solutions/day-14/level1.js b/solutions/day-14/level1.js new file mode 100644 index 0000000..e3496d2 --- /dev/null +++ b/solutions/day-14/level1.js @@ -0,0 +1,37 @@ +// 1. What is component life cycles? +// Component life cycle is the process of mounting, updating and destroying a component in a React application. + +// 2. What is the purpose of life cycles? +// This gives the developers the ability to manage the states or to perform specific operations based on the component life cycles. + +// 3. What are the three stages of a component life cycle? +// - Mounting +// - Updating +// - Unmounting + +// 4. What does mounting means? +// Rendering or putting React component into the DOM + +// 5. What does updating means? +// After a component has been mounted on the DOM, it can be updated when a state or props change. + +// 6. What does unmounting means? +// The unmounting phase removes component from the DOM. + +// 7. What is the most common built-in mounting life cycle method? +// The render() method + +// 8. What are the mounting life cycle methods? +// - constructor() +// - static getDerivedStateFromProps() +// - render() + +// 9. What are the updating life cycle methods? +// - static getDerivedStateFromProps() +// - shouldComponentUpdate() +// - render() +// - getSnapshotBeforeUpdate() +// - componentDidUpdate() + +// 10. What is the unmounting life cycle method? +// - componentDidMount()