├── 2.lifecycle-events-handling.md ├── 4.forms.md ├── 1.component-props-state.md ├── 3.routing-api-handling.md └── README.md /2.lifecycle-events-handling.md: -------------------------------------------------------------------------------- 1 | # Lifecycle | Handling events 2 | 3 | ## Questions 4 | 5 |
6 | 7 | ### 1. What is the order lifecycles in ReactJS ? 8 | 9 | ### 2. What is the difference between React's `handling events` vs HTML `handling events`? 10 | 11 | ### 3. How to send data from `child` component to its parents? 12 | 13 |
14 | 15 | ## Exercises 16 | 17 | ##### Task 1. 18 | Add another state `time: new Date().toLocaleTimeString()` to component `Home.js`. Create a lifecycle `componentDidMount()` and update the value of new state using `this.setState({ time: new Date().toLocaleTimeString() })` for **an interval of 1 second**. Display the value of new state next to the welcome header as: 'Welcome to Rookies. It is 12:26:48 PM' 19 | 20 | ##### Task 2. 21 | Add an additional `` in `src/components/Home.js`. Edit the `clickGame()` method in component `Home.js`, with every **3 clicks**, alert the message `Fizz`, with every **5 clicks**, alert the message `Buzz`, with every **15 clicks**, alert the message `FizzBuzz`. 22 | 23 | [**Hint**] 24 | 25 | - Add new state `clickedTime: 0` in component `Home.js`. Every time the `` in `src/components/Home.js`. Edit the `clickGame()` method in component `Home.js`, with every **3 clicks**, alert the message `Fizz`, with every **5 clicks**, alert the message `Buzz`, with every **15 clicks**, alert the message `FizzBuzz`. 88 | 89 | [**Hint**] 90 | 91 | - Add new state `clickedTime: 0` in component `Home.js`. Every time the `