What is the difference between using {} and not when passing in properties?
Ie
TodoApp = ({props}) => {
console.log(props)
}
and
TodoAp = (props) => {
console.log(props)
}
What is the difference between using {} and not when passing in properties?
Ie
TodoApp = ({props}) => {
console.log(props)
}
and
TodoAp = (props) => {
console.log(props)
}
This is ES6 syntax and not react.
as written in MDN:
The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables.
To the specific example,
In the first example you will unpack the object and take the "props" property out of it, where in the second example you will get the whole object and in order to get the property called "props" you will have to write props.props