Let's suppose that we have a dad component which will leave some great things to his child in heritance. To destructure the props, the child need to use the brackets notation:
jsximport React from 'react'; const Parent = () => { return( <Child money = { 1000000 } houses = { 5 } cars = { 5 } /> ); } const Child = ({ money, houses, cars }) => { return( <div>Let's see what my daddy left me on heritance: { money } $, { houses } houses and { cars } cars. </div> ); } export default Parent;
Using the brackets notation made the child rich.
Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.