G
G
Georgy Pugachev2020-12-04 16:28:19
React
Georgy Pugachev, 2020-12-04 16:28:19

Is it possible to access sub-components from a component?

Hello, let's say there is such a code

<TempList>
    <TempListItem />
    <TempListItem />
    <TempListItem />
</TempList>


Can I get a list of its sub-elements (in this example TempListItem) inside the TempList component? Through props or something else.
The goal I am pursuing is to pass a list structure (with an arbitrary number of elements) to TempList and fill in sub-elements according to this structure.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
TRNER, 2020-12-04
@gvpugachev

props.children

K
Kirill Makarov, 2020-12-04
@kirbi1996

You can set this list in the parent and pass it to the child, or as a redux mobx option. Or usecontext

C
Cool Admin, 2016-11-23
@ifaustrue

So you change the server in the DNS settings to a normal one, for example, to 8.8.8.8 and check. If the problem repeats, then it's not the DNS, but in general you don't have the Internet.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question