Basically: :ReactElement == html + custom components :ReactText == strings + numbers :ReactChild == ReactElement + ReactText :ReactNode == ReactChild + null + undefined + Array of them phew!
-
-
Prikaži ovu nitHvala. Twitter će to iskoristiti za poboljšanje vaše vremenske crte. PoništiPoništi
-
-
-
also worth mentioning that ReactNode is almost useless as a type - it accepts too much, e.g. also new Date(), that will throw at runtime
-
ouch!
Kraj razgovora
Novi razgovor -
-
-
Interesting. I've always used JSX.Element. Had no idea ReactElement was a type. Now I'm curious to know what the difference is.
-
Ok. So this makes more sense. https://bit.ly/2FuSNDn When I use JSX.Element as a type for a component's children, I often have to write it as a union of JSX.Element | JSX.Element[] But I don't have to do that with React.ReactNodepic.twitter.com/F3hxZyDzQz
Kraj razgovora
Novi razgovor -
-
-
I've always found the distinction between child and node confusing. For example you can pass null as a child, so why isn't null part of the child type?
Hvala. Twitter će to iskoristiti za poboljšanje vaše vremenske crte. PoništiPoništi
-
-
-
Not to mention the React.Children just gets me everytime until I realize it is for the Children(), you should use ReactNode
Hvala. Twitter će to iskoristiti za poboljšanje vaše vremenske crte. PoništiPoništi
-
-
-
Thank you!
#react (yeah, I like@typescript btw
)Hvala. Twitter će to iskoristiti za poboljšanje vaše vremenske crte. PoništiPoništi
-
-
-
JavaScript is fundamentally about conveniency and dynamism. It's not surprising that this language wasn't designed to be typed and used for real industrial grade application. Where ReasonML and OCaml have designed to be from the beginning.
Hvala. Twitter će to iskoristiti za poboljšanje vaše vremenske crte. PoništiPoništi
-
-
-
And for render props? Ie. When 'children' is a function? ReactNode?
Hvala. Twitter će to iskoristiti za poboljšanje vaše vremenske crte. PoništiPoništi
-
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.
· writes about