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?
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.
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!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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?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: thechildren
of this HOC should be of typeReact.ReactNode
. If you don't work with TS, you can skip that code all together.Thanks. I am already overwhelmed by the amount of material i have to learn. I don't want to add TS to the list.
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!