You get a bonus - 1 coin for daily activity. Now you have 1 coin

Why should we be careful when spreading props on DOM elements? in REACT

Practice



When we spread props, we risk adding unknown HTML attributes, which is bad practice. Instead we can destructure the props with the

...rest
operator, so that only the necessary props are added. For example,
const  ComponentA  = () => < ComponentB  isDisplay = { true }  className = { ' componentStyle ' } />

const  ComponentB  = ({ isDisplay , ... domProps }) => < div  { ... domProps } > { ' ComponentB ' } </ div >

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Scripting client side JavaScript, jqvery, BackBone"

Terms: Scripting client side JavaScript, jqvery, BackBone