I have seen { props } = this, within the following piece of code. What is this used?
render = () => {
const { props } = this
I have seen { props } = this, within the following piece of code. What is this used?
render = () => {
const { props } = this
This is not a feature of React. This is the destructuring syntax of JS. Any object which looks like the following :-
let obj = {name:'Arjunan'}
can be destructured to access name
property like :-
const {name} = obj
In your question, this
is the object created using your React class constructor and the property props
exist on it.