ReactJS component names must begin with capital letters?

后端 未结 5 1999
忘了有多久
忘了有多久 2020-11-22 04:56

I am playing around with the ReactJS framework on JSBin.

I have noticed that if my component name starts with a lowercase letter it does not work.

For instan

5条回答
  •  时光说笑
    2020-11-22 05:33

    In JSX, lower-case tag names are considered to be HTML tags. However, lower-case tag names with a dot (property accessor) aren't.

    See HTML tags vs React Components.

    • compiles to React.createElement('component') (html tag)
    • compiles to React.createElement(Component)
    • compiles to React.createElement(obj.component)

提交回复
热议问题