Choosing the Type at Runtime

  You cannot use a general expression as the React element type. If you do want to use a general expression to indicate the type of the element, just assign it to a capitalized variable first. This often comes up when you want to render a different component based on a prop:

  Choosing the Type at Runtime

  To fix this, we will assign the type to a capitalized variable first:

  Choosing the Type at Runtime

参考:https://facebook.github.io/react/docs/jsx-in-depth.html#user-defined-components-must-be-capitalized

相关文章:

  • 2021-08-12
  • 2022-12-23
  • 2022-03-10
  • 2021-11-01
  • 2021-11-13
  • 2021-12-11
  • 2021-10-15
  • 2022-01-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-29
  • 2021-11-19
  • 2021-11-24
  • 2022-12-23
  • 2021-08-05
相关资源
相似解决方案