Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

react element assign multiple attributes

// you can assign multiple attributes by destructuring props in react without
// doing the common way: x={props.v} one by one till your keyboard break.
// example:
<input {...props} />

// you may want to filter the props before blindly destructure it inside the
// element.
// example:
const {onClick, onChange, ...filtered} = props
<input {...filtered} />
 
PREVIOUS NEXT
Tagged: #react #element #assign #multiple #attributes
ADD COMMENT
Topic
Name
5+3 =