1.

What is known as Fragment in React.

Answer»
  • How to return multiple components WITHOUT wrapping using DIV, HOC or Fragment
  • Fragments help you return a LIST of items without adding extra nodes to the DOM.
  • Return as an Array. This is introduced since React 16
import React from "react"; import ReactDOM from "react-dom"; import "./styles.css"; function App() { return ( [ <P&GT;one</p>, <p>two</p> ] ); } const rootElement = document.getElementById("root"); ReactDOM.render(<App />, rootElement);


Discussion

No Comment Found