Why do React components need to start with capital letters?
If you’ve ever worked with React, you might have noticed that component names always...
For further actions, you may consider blocking this person and/or reporting abuse
Has nothing to do with React. It's a JSX assumption to distinguish between a built-in (string) and a reference. Plus you don't need it - if it's a member (contains a dot) it will also be taken as a reference.
False
Care to elaborate?
Maybe try it out first, before writing something:
<foo.bar />
resolves toh(foo.bar)
and noth("foo.bar")
- so I am not sure if have some experience with JSX or just like to troll.Short and informative thanks!
Thanks ❣️
What about const SomeName = "some value" and projects without Babel?
SomeName
simply a variable, not a react component. Capitalization rule will not apply here, because its not being used as a react component here.Projects without babel, then React.createElement() Api is used Explicitly.
BTW, using Capital letters in Components, helps react to differentiate between
Native Elements and custom Components.
Eg.
If MyComponent is written in lower case (myComponent), React will look for a native HTML element
<myComponent>
which doesn't exists, causing the app to fail.I’m fairly sure for this they just check whether typeof input is string.
I see the point with createElement, but I still can write lower case functional component on a project without Babel and still get the error. So it's not Babel concern, as your article states
You're absolutely right! The capitalization rule in React isn't tied specifically to
Babel
, but rather to React itself. While Babel helps by converting JSX intoReact.createElement()
calls.This is not true either since React 17 jsx runtime
The comments are always like, well actually It is blah blah blah.
That translates to, oh, I know something different. Let me sh*t on this post.
The fun part is usually they're wrong.
That's good to know! Had always assumed it was just a matter of convention, although it would feel very strange to not capitalize a React component at this point :)
I know. The convention just sticks
This post was necessay just to know why
Ahhhha nice!
Thanks
Could you tell me cons of virtual dom in react js?
I don't think there are any cons in React.js Virtual DOM. But these could be:
nyc information
Thanks
thanks
You are Welcome
It was pretty obvious to me, thanks for laying it out and validating my assumptions
Thanks
Thanks for this informative article
Thanks
Good recap and informative too. Thanks
Thanks
Short and sweet!
Thanks
Fragile tech
Thanks
Thanks good to remember!
Thanks Man
To the point and informative which clears the basic concept, thank you
Thanks man
Thank you 👍
You are Welcome 😊
Good information, thanks for providing
Thanks ❣️
Very good. Thank you!
Thank You ❣️
Thanks for the insight from the article and the informative comments. I've have learned and it's a good step to go and study more on the topic.
Thanks
Thanks ❣️
Quick and to the point. Upvote!
Thanks
New information, thank.❤️
Thanks ❣️
On a side note, Kotlin's Composable function components for Android, also start with a capital letter.
Thanks for Sharing
Thank you for sharing useful information
Thank you so much
Concise and to the point. I love this!
Thanks Man ❣️