The problem that the formal parameter of a function parameter is an object

Today, in React, the way components are written is how props is passed.

Sub-component A:

const A = ({arg1,arg2}) => {
    ...
}

parent component B:

const B = () => {
    <A arg1={method1} arg2={method2} />
}

Why are the function parameters in An enclosed in curly braces {} instead of being written as const A = (arg1,arg2) ?

Jul.29,2021

deconstruct

if you pass an object {arg1:1, arg2:2} , then the values of arg1 and arg2 of formal parameters will be assigned to 1,2

.

if you don't understand, please refer to

Previous: How to dynamically add responsive properties to vm instances in vuejs?

Next: How to customize the routing of php suffixes in ThinkPHP V5.1.18

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b44c-2c25f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b44c-2c25f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?