< 1 minute read

In React Components we can make use of the children (props.children) to pass content from one component to another.
We need to make use of the Component API and make use of the props.

It doesn’t matter if you have a class component or function component, the props should never change.

Props are Read-Only.

Code example on how to pass the content of a component using this.props.children:

const MyComponent = props => {props.children}

You can use this.props.children to render whatever children the component contains:

import React from 'react'

const MyComponent = props => {props.children};

const WrapperComponent = () => 

Hello world!

; export default WrapperComponent;

Then to consume the newly created component, just use export default WrapperComponent and then elsewhere import {WrapperComponent} from “./WrapperComponent“.

How Much Traffic Can Your Website Handle?