14. Fragment
Course: React - chapter 14
In React, a component can return a single parent element, but it can contain multiple children within that single parent
Wrong code
Section titled “Wrong code”const MyComponent = () => { return ( <h1>Hello</h1> <p>World</p> // This line will cause an error );};Right code
Section titled “Right code”const MyComponent = () => { return ( <> <h1>Hello</h1> <p>World</p> </> );};