标签: 开发踩坑

1 个内容

动态(1)

E
Elliot Yang
公开

How to use React label element?

If you try to render a <label> element bound to a text input using the standard for attribute, then it produces HTML missing that attribute and prints a warning to the console.
js
1<label for={'user'}>{'User'}</label>
2<input type={'text'} id={'user'} />
Since for is a reserved keyword in JavaScript, use htmlFor instead.
js
1<label htmlFor={'user'}>{'User'}</label>
2<input type={'text'} id={'user'} />
浏览:244点赞:0