M
M
miliko mikoyan2018-12-20 22:08:06
React
miliko mikoyan, 2018-12-20 22:08:06

What is {this.props.children} and when should you use it?

Being new to the React world, I want to understand in depth what happens when I use {this.props.children} and in what situations to use it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Laud, 2018-12-20
@miliko0022

Children gets an array of elements that are "inside" the component. For example, in this case:

<SomeComponent>
    <ChildComponent />
    <ChildComponent />
    <ChildComponent />
</SomeComponent>

SomeComponent will receive props, where all ChildComponent will be in children.

D
dev null, 2018-12-20
@curious-101

Why wasn't the answer translated? https://stackoverflow.com/questions/49706823/what-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question