Application form element reactjs

input type=”text”

data:

image

JSX:

image

function:

image

Achieved here it is equivalent to the v-model vue

jsx a defaultValue attribute syntax has, in fact, a native DOM attribute value in the

principle:

Model -> state in view of binding data by the attribute value, the rendering of the data view

View -> View monitor data model by changing the onChange event, in fact, listen and get defaultValue value

DefaultValue setState loaded into and through the state (defaultValue == e.target.value)

Data flow:

initStateData –> valueBind –> initViewData –> viewDataChange –> onChange –> getDefaultValue –> setStateData –> stateDataChange –> valueBind –> viewDataChange

input type=”radio”

data:

image

JSX:

image

function:

image

input type=”checkbox”

data:

image

JSX:

image

function:

image

Note that the application of extended operator, the role is a copy target hobbies

select>option

data:

image

JSX:

image

function:

image

effect:

image

Guess you like

Origin www.cnblogs.com/chujunqiao/p/11778031.html