React开发中与JSX的不同点

style参数

JSX中须要使用对象的方式给style属性赋值;在NornJ模板中可以直接使用与html完全相同的style语法:

<div style="color:purple;font-size:1rem;">test</div>

class和for参数

JSX中须要使用classNamehtmlFor来给classfor赋值;在NornJ模板中可以直接使用与html完全相同的参数名:

<input type="checkbox" name="test" class="cbx" />
<label for="test">test</label>

results matching ""

    No results matching ""