DEV Community

Fatima Alam
Fatima Alam

Posted on

React Children

function Child() {
  return <div>This is children content</div>;
}

// Add code only here
function Parent(props) {
  return (
    <div>
      <h3>Parent Component</h3>
      {props.children}
    </div>
  );
}

function App() {
  return (
    <Parent>
      <Child />
    </Parent>
  );
}

ReactDOM.render(<App />, document.getElementById("root"));
Enter fullscreen mode Exit fullscreen mode

Top comments (0)