简体   繁体   中英

Formatting multiple props in react-native stateless component

I am trying to find the best practices for formatting a stateless component which has multiple props. I understand that the norm is to do the following:

const myItem = ({myProp, AnotherProp}) => {

}

I would like to understand how best to approach this when the number of props means the length of line containing myItem would mean it extends 80 characters. I have looked at style guides such as the Air BnB React guide and also their Javascript guide, but still I haven't found the correct approach here.

The exact way you might be looking for is this:

const myItem = (props) => {
   const { myProp,AnotherProp } = props  
   console.log('all props extracted', myProp,AnotherProp) 
}

Cheers :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM