Why do we use fragments in react? 1

Why do we use fragments in react?

Fragments let you group a list of children without adding extra nodes to the DOM.

Here is what the above code is Doing:
1. We create a new React element.
2. We pass that element to ReactDOM.render().
3. React calls the Clock component’s render() method.
4. React updates the DOM to match the Clock’s render output.
5. React calls the Clock component’s render() method again.
6. React updates the DOM again.
7. Repeat from step 3.

Similar Posts