React ignores 'for' attribute of the label element

前端 未结 6 1881
太阳男子
太阳男子 2020-12-02 06:30

In React (Facebook\'s framework), I need to render a label element bound to a text input using the standard for attribute.

e.g. the following JSX is use

6条回答
  •  情深已故
    2020-12-02 06:55

    The for attribute is called htmlFor for consistency with the DOM property API. If you're using the development build of React, you should have seen a warning in your console about this.

提交回复
热议问题