DEV Community

Discussion on: React - how to render adjacent JSX elements

Collapse
nibble profile image
Joseph Mawa

A quick question here. I know about HOC but i am struggling to make sense of the parameter. What is { children: React.ReactNode } part of the parameter?

Thread Thread
arikaturika profile image
Arika O Author

That's actually Typescript code. For some reason, the online editor I am using to test my code was throwing an error because I didn't specify the children type, so I had to add it (probably Typescript was included in the dependencies). That code translates to: the children of this HOC should be of type React.ReactNode. If you don't work with TS, you can skip that code all together.

Thread Thread
nibble profile image
Joseph Mawa

Thanks. I am already overwhelmed by the amount of material i have to learn. I don't want to add TS to the list.

Thread Thread
arikaturika profile image
Arika O Author

If you will ever want to learn TS, I would advise you to learn it separately from React, otherwise it will be very overwhelming, as you said. I had to learn them at the same time for work and sometimes I couldn't tell which one is a React feature and which one is TS. Good luck!